Skip to main content

Module sync

Module sync 

Source
Expand description

The syncer downloads and verifies large numbers of blocks from peers to Zebra.

It is used when Zebra is a long way behind the current chain tip.

ModulesΒ§

downloads πŸ”’
A download stream for Zebra’s block syncer.
end_of_support
End of support checking task.
gossip πŸ”’
A task that gossips newly verified block::Hashes to peers.
hedge πŸ”’
Preserve a live hedge arm when its sibling exhausts its retries.
progress πŸ”’
Progress tracking for blockchain syncing.
recent_sync_lengths πŸ”’
A channel which holds a list of recent syncer response lengths.
status πŸ”’
Syncer chain tip status, based on recent block locator responses from peers.

StructsΒ§

ChainSync
CheckedTip πŸ”’
Helps work around defects in the bitcoin protocol by checking whether the returned hashes actually extend a chain tip.
Config
Sync configuration section.
RecentSyncLengths
A helper type which holds a list of recent syncer response lengths. These sync lengths can be used to work out if Zebra has reached the end of the chain.
SyncStatus
A helper type to determine if the synchronizer has likely reached the chain tip.

EnumsΒ§

BlockGossipError
Errors that can occur when gossiping committed blocks

ConstantsΒ§

BLOCK_DOWNLOAD_RETRY_LIMIT πŸ”’
Controls how many times we will retry each block download.
BLOCK_DOWNLOAD_ROUND_TIMEOUT πŸ”’
Bounds one complete block download round, including readiness, capacity waits and both hedges.
BLOCK_DOWNLOAD_TIMEOUT πŸ”’
The per-peer wire-response budget used to derive complete download deadlines.
BLOCK_VERIFY_TIMEOUT πŸ”’
Controls how long we wait for a block verify request to complete.
DEFAULT_CHECKPOINT_CONCURRENCY_LIMIT
The default for the user-specified lookahead limit.
FANOUT πŸ”’
Controls the number of peers used for each ObtainTips and ExtendTips request.
FINAL_CHECKPOINT_BLOCK_VERIFY_TIMEOUT πŸ”’
A shorter timeout used for the first few blocks after the final checkpoint.
FINAL_CHECKPOINT_BLOCK_VERIFY_TIMEOUT_LIMIT πŸ”’
The number of blocks after the final checkpoint that get the shorter timeout.
GENESIS_TIMEOUT_RETRY πŸ”’
Controls how long we wait to retry a failed attempt to download and verify the genesis block.
MAX_BLOCK_REOBTAIN_RETRIES πŸ”’
Controls how many times the syncer will re-request a block whose download failed because no peer delivered it (a NotFound), before giving up and letting the normal tip re-walk handle it.
MAX_TIPS_RESPONSE_HASH_COUNT
The expected maximum number of hashes in an ObtainTips or ExtendTips response.
MIN_CHECKPOINT_CONCURRENCY_LIMIT
A lower bound on the user-specified checkpoint verification concurrency limit.
MIN_CONCURRENCY_LIMIT
A lower bound on the user-specified concurrency limit.
MIN_UTXO_RACE_DROPS_BEFORE_RESTART πŸ”’
The fewest TransparentInputNotFound drops without a verified block before the sync restarts, so a low full_verify_concurrency_limit can’t disable the #11168 exemption.
PEER_GOSSIP_DELAY
Controls how long we wait between gossiping successive blocks or transactions.
REGTEST_SYNC_RESTART_DELAY πŸ”’
In regtest, use a much shorter restart delay so that downstream nodes pick up newly-mined blocks quickly (e.g. after generate(N) in integration tests). The default 67-second delay exceeds the typical sync_all timeout of 60 seconds.
SYNC_RESTART_DELAY πŸ”’
Controls how long we wait to restart syncing after finishing a sync run.
TIPS_RESPONSE_TIMEOUT
Controls how long we wait for a tips response to return.
VERIFICATION_PIPELINE_SCALING_MULTIPLIER
A multiplier used to calculate the extra number of blocks we allow in the verifier, state, and block commit pipelines, on top of the lookahead limit.

FunctionsΒ§

gossip_best_tip_block_hashes
Run continuously, gossiping newly verified block::Hashes to peers.
is_not_found πŸ”’
Match the missing-block errors used by both hedging and sync recovery.
show_block_chain_progress
Logs Zebra’s estimated progress towards the chain tip every minute or so, and updates a terminal progress bar every few seconds.