Skip to main content

Module sync

Module sync 

Source
Expand description

Block sync: allows a node that is behind to catch up by requesting missing blocks from peers and replaying the commit lifecycle.

Structs§

SyncState
Mutable state needed by block sync and replay.

Functions§

query_peer_status
Query a peer’s status via the sync channel. Returns None on timeout/error.
replay_blocks
Replay a batch of blocks: store them and run the application lifecycle. Validates chain continuity (parent_hash linkage). Replay synced blocks and return any pending epoch that hasn’t reached its start_view yet. The caller should store this as pending_epoch in the engine so the epoch transition fires at the correct view.
sync_to_tip
Run block sync: request missing blocks from peers and replay them.
sync_via_snapshot
Attempt state sync via snapshots. Returns Ok(true) if successful, Ok(false) if no snapshots are available (caller should fall back to block sync).