Trait ChainInfo

Source
pub trait ChainInfo<Block>:
    Clone
    + Send
    + Sync
where Block: GenericOwnedBlock,
{ // Required methods fn best_root(&self) -> BlockRoot; fn best_header(&self) -> Block::Header; fn best_header_with_details(&self) -> (Block::Header, BlockDetails); fn ancestor_header( &self, ancestor_block_number: BlockNumber, descendant_block_root: &BlockRoot, ) -> Option<Block::Header>; fn header(&self, block_root: &BlockRoot) -> Option<Block::Header>; fn header_with_details( &self, block_root: &BlockRoot, ) -> Option<(Block::Header, BlockDetails)>; }
Expand description

Chain info.

NOTE:

Blocks or their parts returned from these APIs are reference-counted and cheap to clone. However, it is not expected that they will be retained in memory for a long time. Blocks and headers will not be pruned until their reference count goes down to one. This is imported when there is an ongoing block import happening and its parent must exist until the import finishes.

Required Methods§

Source

fn best_root(&self) -> BlockRoot

Best block root

Source

fn best_header(&self) -> Block::Header

Best block header

Source

fn best_header_with_details(&self) -> (Block::Header, BlockDetails)

Returns the best block header like Self::best_header() with additional block details

Source

fn ancestor_header( &self, ancestor_block_number: BlockNumber, descendant_block_root: &BlockRoot, ) -> Option<Block::Header>

Get header of ancestor block number for descendant block root

Source

fn header(&self, block_root: &BlockRoot) -> Option<Block::Header>

Block header

Source

fn header_with_details( &self, block_root: &BlockRoot, ) -> Option<(Block::Header, BlockDetails)>

Returns a block header like Self::header() with additional block details

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§