Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function for syncing blocks from Zebra's non-finalized best chain to a ReadStateService in another process #8576

Open
Tracked by #8632
arya2 opened this issue Jun 3, 2024 · 0 comments · May be fixed by #8596
Assignees
Labels
A-rpc Area: Remote Procedure Call interfaces A-state Area: State / database changes C-feature Category: New features

Comments

@arya2
Copy link
Contributor

arya2 commented Jun 3, 2024

Motivation

We want the ChainTipChange struct to work in a separate process so it can be used in zebra-scan and/or the indexer.

We also want to have access to all of Zebra's best chain via the ReadStateService from another process, including blocks in the non-finalized portion of Zebra's best chain.

Note: Accessing the finalized portion of Zebra's best chain should only require a ReadStateService initialized with a read-only ZebraDb using the same cache directory (except maybe when Zebra is configured to use an ephemeral state).

Design

Add a function in zebra-rpc that:

  • Polls the getbestblockhash method to check if a process has the latest best chain tip in Zebra
  • Calls the getblock method to sync any blocks in Zebra that are missing in the new process
  • Infers when there's been a chain fork/reorganization and re-syncs all of the blocks past the finalized tip from Zebra
  • Sends new blocks to the LatestChainTip channel used by ChainTipChange

This function could returns a ChainTipChange struct, or accept a ChainTipSender.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Area: Remote Procedure Call interfaces A-state Area: State / database changes C-feature Category: New features
Projects
Status: Review/QA
1 participant