pub trait ChainInfo<Block>:
Clone
+ Send
+ Syncwhere
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§
Sourcefn best_header(&self) -> Block::Header
fn best_header(&self) -> Block::Header
Best block header
Sourcefn best_header_with_details(&self) -> (Block::Header, BlockDetails)
fn best_header_with_details(&self) -> (Block::Header, BlockDetails)
Returns the best block header like Self::best_header()
with additional block details
Sourcefn ancestor_header(
&self,
ancestor_block_number: BlockNumber,
descendant_block_root: &BlockRoot,
) -> Option<Block::Header>
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
Sourcefn header_with_details(
&self,
block_root: &BlockRoot,
) -> Option<(Block::Header, BlockDetails)>
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.