[−][src]Struct snarkos_network::protocol::sync::SyncHandler
Manages syncing chain state with a sync node.
- The server_node sends a GetSync message to a sync_node.
- The sync_node responds with a Sync message with block_headers the server_node is missing.
- The server_node sends a GetBlock message for each BlockHeaderHash in the message.
Fields
sync_node: SocketAddr
sync_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]
&'_ mut self,
channel: Arc<Channel>,
storage: Arc<Ledger<T, P>>
) -> Result<(), SendError>
Finish syncing or ask for the next block from the sync node.
Auto Trait Implementations
impl RefUnwindSafe for SyncHandler
impl Send for SyncHandler
impl Sync for SyncHandler
impl Unpin for SyncHandler
impl UnwindSafe for SyncHandler
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,