pub struct SyncShared { /* private fields */ }Expand description
Sync state shared between sync and relayer protocol
Implementations§
Sourcepub fn new(
shared: Shared,
sync_config: SyncConfig,
tx_relay_receiver: Receiver<TxVerificationResult>,
) -> SyncShared
pub fn new( shared: Shared, sync_config: SyncConfig, tx_relay_receiver: Receiver<TxVerificationResult>, ) -> SyncShared
Create a SyncShared
Shared chain db/config
Sourcepub fn active_chain(&self) -> ActiveChain
pub fn active_chain(&self) -> ActiveChain
Get snapshot with current chain
Sourcepub fn insert_valid_header(&self, peer: PeerIndex, header: &HeaderView)
pub fn insert_valid_header(&self, peer: PeerIndex, header: &HeaderView)
Sync a new valid header, try insert to sync state
Sourcepub fn is_stored(&self, hash: &Byte32) -> bool
pub fn is_stored(&self, hash: &Byte32) -> bool
Check whether block has been inserted to chain store
Sourcepub fn get_epoch_ext(&self, hash: &Byte32) -> Option<EpochExt>
pub fn get_epoch_ext(&self, hash: &Byte32) -> Option<EpochExt>
Get epoch ext by block hash
Sourcepub fn insert_peer_unknown_header_list(
&self,
pi: PeerIndex,
header_list: Vec<Byte32>,
)
pub fn insert_peer_unknown_header_list( &self, pi: PeerIndex, header_list: Vec<Byte32>, )
Insert peer’s unknown_header_list
Sourcepub fn new_block_received(&self, block: &BlockView) -> bool
pub fn new_block_received(&self, block: &BlockView) -> bool
Return true when the block is that we have requested and received first time.
Trait Implementations§
Source§fn clone(&self) -> SyncShared
fn clone(&self) -> SyncShared
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§fn get_header_fields(&self, hash: &Byte32) -> Option<HeaderFields>
fn get_header_fields(&self, hash: &Byte32) -> Option<HeaderFields>
Get the header fields of the given block hash
Auto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more