Skip to main content

SnapSyncContext

Trait SnapSyncContext 

Source
pub trait SnapSyncContext: Send {
    // Required methods
    fn head(&self) -> Result<u64, SnapSyncError>;
    fn wait_for_progress(
        &mut self,
        head: u64,
    ) -> impl Future<Output = bool> + Send;

    // Provided method
    fn finalized(&self) -> Result<Option<u64>, SnapSyncError> { ... }
}
Expand description

What a SnapBootstrap needs to know about the chain and peers it synchronizes from.

Required Methods§

Source

fn head(&self) -> Result<u64, SnapSyncError>

Highest block whose canonical header is downloaded.

Source

fn wait_for_progress(&mut self, head: u64) -> impl Future<Output = bool> + Send

Waits for a reason to retry the stalled step and returns true if one came, such as new peers connecting or a retry delay passing. Returns false if the run should stop instead, so the caller can refresh its headers, as when a new target arrived or the source of targets is gone.

Provided Methods§

Source

fn finalized(&self) -> Result<Option<u64>, SnapSyncError>

Latest finalized block, preferred as the pivot when recent enough. None if no finalized block is known locally yet.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§