[][src]Struct snarkos_network::protocol::sync::SyncHandler

pub struct SyncHandler {
    pub sync_node: SocketAddr,
    pub sync_state: SyncState,
    // some fields omitted
}

Manages syncing chain state with a sync node.

  1. The server_node sends a GetSync message to a sync_node.
  2. The sync_node responds with a Sync message with block_headers the server_node is missing.
  3. The server_node sends a GetBlock message for each BlockHeaderHash in the message.

Fields

sync_node: SocketAddrsync_state: SyncState

Implementations

impl SyncHandler[src]

pub fn new(bootnode: SocketAddr) -> Self[src]

Construct a new SyncHandler.

pub fn update_syncing(&mut self, block_height: u32)[src]

Set the SyncState to syncing and update the latest block height.

pub fn receive_hashes(&mut self, hashes: Vec<BlockHeaderHash>, height: u32)[src]

Process a vector of block header hashes. Push new hashes to the sync handler so we can ask the sync node for them.

pub async fn increment<T: Transaction, P: LoadableMerkleParameters, '_>(
    &'_ mut self,
    channel: Arc<Channel>,
    storage: Arc<Ledger<T, P>>
) -> Result<(), SendError>
[src]

Finish syncing or ask for the next block from the sync node.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,