[−][src]Struct ckb_snapshot::Snapshot
A snapshot captures a point-in-time view of the DB at the time it's created
Implementations
impl Snapshot
[src]
pub fn new(
tip_header: HeaderView,
total_difficulty: U256,
epoch_ext: EpochExt,
store: StoreSnapshot,
proposals: ProposalView,
consensus: Arc<Consensus>
) -> Snapshot
[src]
tip_header: HeaderView,
total_difficulty: U256,
epoch_ext: EpochExt,
store: StoreSnapshot,
proposals: ProposalView,
consensus: Arc<Consensus>
) -> Snapshot
New snapshot created after tip change
pub fn refresh(&self, store: StoreSnapshot) -> Snapshot
[src]
Refreshing on block commit is necessary operation, even tip remains unchanged. when node relayed compact block,if some uncles were not available from receiver's local sources, in GetBlockTransactions/BlockTransactions roundtrip, node will need access block data of uncles.
pub fn tip_header(&self) -> &HeaderView
[src]
Return reference of tip header
pub fn tip_number(&self) -> BlockNumber
[src]
Return tip header number
pub fn tip_hash(&self) -> Byte32
[src]
Return tip header hash
pub fn epoch_ext(&self) -> &EpochExt
[src]
Return current epoch information
pub fn consensus(&self) -> &Consensus
[src]
Return reference of Consensus
pub fn cloned_consensus(&self) -> Arc<Consensus>
[src]
Makes a clone of the Arc<Consensus>
pub fn proposals(&self) -> &ProposalView
[src]
Return reference of proposals view
pub fn total_difficulty(&self) -> &U256
[src]
Return current best chain total_difficulty
pub fn finalize_block_reward(
&self,
parent: &HeaderView
) -> Result<(Script, BlockReward), Error>
[src]
&self,
parent: &HeaderView
) -> Result<(Script, BlockReward), Error>
Shortcuts for calculate block reward, invoke RewardCalculator
Trait Implementations
impl BlockMedianTimeContext for Snapshot
[src]
pub fn median_block_count(&self) -> u64
[src]
pub fn timestamp_and_parent(&self, block_hash: &Byte32) -> (u64, u64, Byte32)
[src]
pub fn block_median_time(&self, block_hash: &Byte32) -> u64
[src]
impl CellProvider for Snapshot
[src]
pub fn cell(&self, out_point: &OutPoint, with_data: bool) -> CellStatus
[src]
impl<'a> ChainStore<'a> for Snapshot
[src]
type Vector = DBPinnableSlice<'a>
TODO(doc): @quake
pub fn cache(&'a self) -> Option<&'a StoreCache>
[src]
pub fn get(&'a self, col: Col, key: &[u8]) -> Option<Self::Vector>
[src]
pub fn get_iter(&self, col: Col, mode: IteratorMode<'_>) -> DBIter<'_>
[src]
pub fn get_tip_header(&self) -> Option<HeaderView>
[src]
pub fn get_current_epoch_ext(&'a self) -> Option<EpochExt>
[src]
pub fn cell_provider(&self) -> CellProviderWrapper<'_, Self>
[src]
pub fn get_block(&'a self, h: &Byte32) -> Option<BlockView>
[src]
pub fn get_block_header(&'a self, hash: &Byte32) -> Option<HeaderView>
[src]
pub fn get_block_body(&'a self, hash: &Byte32) -> Vec<TransactionView, Global>
[src]
pub fn get_block_txs_hashes(&'a self, hash: &Byte32) -> Vec<Byte32, Global>
[src]
pub fn get_block_proposal_txs_ids(
&'a self,
hash: &Byte32
) -> Option<ProposalShortIdVec>
[src]
&'a self,
hash: &Byte32
) -> Option<ProposalShortIdVec>
pub fn get_block_uncles(&'a self, hash: &Byte32) -> Option<UncleBlockVecView>
[src]
pub fn get_block_ext(&'a self, block_hash: &Byte32) -> Option<BlockExt>
[src]
pub fn get_block_hash(&'a self, number: u64) -> Option<Byte32>
[src]
pub fn get_block_number(&'a self, hash: &Byte32) -> Option<u64>
[src]
pub fn is_main_chain(&'a self, hash: &Byte32) -> bool
[src]
pub fn transaction_exists(&'a self, hash: &Byte32) -> bool
[src]
pub fn get_transaction(
&'a self,
hash: &Byte32
) -> Option<(TransactionView, Byte32)>
[src]
&'a self,
hash: &Byte32
) -> Option<(TransactionView, Byte32)>
pub fn get_transaction_with_info(
&'a self,
hash: &Byte32
) -> Option<(TransactionView, TransactionInfo)>
[src]
&'a self,
hash: &Byte32
) -> Option<(TransactionView, TransactionInfo)>
pub fn get_transaction_info(&'a self, hash: &Byte32) -> Option<TransactionInfo>
[src]
pub fn get_cell(&'a self, out_point: &OutPoint) -> Option<CellMeta>
[src]
pub fn get_cell_data(&'a self, out_point: &OutPoint) -> Option<(Bytes, Byte32)>
[src]
pub fn get_epoch_ext(&'a self, hash: &Byte32) -> Option<EpochExt>
[src]
pub fn get_epoch_index(&'a self, number: u64) -> Option<Byte32>
[src]
pub fn get_block_epoch_index(&'a self, block_hash: &Byte32) -> Option<Byte32>
[src]
pub fn get_block_epoch(&'a self, hash: &Byte32) -> Option<EpochExt>
[src]
pub fn is_uncle(&'a self, hash: &Byte32) -> bool
[src]
pub fn get_uncle_header(&'a self, hash: &Byte32) -> Option<HeaderView>
[src]
pub fn block_exists(&'a self, hash: &Byte32) -> bool
[src]
pub fn get_cellbase(&'a self, hash: &Byte32) -> Option<TransactionView>
[src]
pub fn next_epoch_ext(
&'a self,
consensus: &Consensus,
last_epoch: &EpochExt,
header: &HeaderView
) -> Option<EpochExt>
[src]
&'a self,
consensus: &Consensus,
last_epoch: &EpochExt,
header: &HeaderView
) -> Option<EpochExt>
pub fn get_packed_block(&'a self, hash: &Byte32) -> Option<Block>
[src]
pub fn get_packed_block_header(&'a self, hash: &Byte32) -> Option<Header>
[src]
impl HeaderChecker for Snapshot
[src]
impl HeaderProvider for Snapshot
[src]
pub fn get_header(&self, hash: &Byte32) -> Option<HeaderView>
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Snapshot
[src]
impl Send for Snapshot
[src]
impl Sync for Snapshot
[src]
impl Unpin for Snapshot
[src]
impl !UnwindSafe for Snapshot
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsAny for T where
T: Any,
T: Any,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Erased for T
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
pub 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.
pub 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>,