Struct ckb_sync::SyncShared
source · 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
only use on test
sourcepub fn with_tmpdir<P>(
shared: Shared,
sync_config: SyncConfig,
tmpdir: Option<P>,
tx_relay_receiver: Receiver<TxVerificationResult>
) -> SyncSharedwhere
P: AsRef<Path>,
pub fn with_tmpdir<P>( shared: Shared, sync_config: SyncConfig, tmpdir: Option<P>, tx_relay_receiver: Receiver<TxVerificationResult> ) -> SyncSharedwhere P: AsRef<Path>,
Generate a global sync state through configuration
Shared chain db/config
sourcepub fn active_chain(&self) -> ActiveChain
pub fn active_chain(&self) -> ActiveChain
Get snapshot with current chain
sourcepub fn insert_new_block(
&self,
chain: &ChainController,
block: Arc<BlockView>
) -> Result<bool, CKBError>
pub fn insert_new_block( &self, chain: &ChainController, block: Arc<BlockView> ) -> Result<bool, CKBError>
Insert new block to chain store
sourcepub fn try_search_orphan_pool(&self, chain: &ChainController)
pub fn try_search_orphan_pool(&self, chain: &ChainController)
Try to find blocks from the orphan block pool that may no longer be orphan
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
Trait Implementations§
source§fn clone(&self) -> SyncShared
fn clone(&self) -> SyncShared
Returns a copy 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
source§fn block_median_time(
&self,
block_hash: &Byte32,
median_block_count: usize
) -> u64
fn block_median_time( &self, block_hash: &Byte32, median_block_count: usize ) -> u64
Get past block median time, including the timestamp of the given one
Auto Trait Implementations§
Blanket Implementations§
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more