Trait polkadot_service::HeaderProvider

source ·
pub trait HeaderProvider<Block, Error = Error>: Send + Sync + 'static
where Block: BlockT, Error: Debug + Send + Sync + 'static,
{ // Required methods fn header( &self, hash: <Block as BlockT>::Hash, ) -> Result<Option<<Block as BlockT>::Header>, Error>; fn number( &self, hash: <Block as BlockT>::Hash, ) -> Result<Option<<<Block as BlockT>::Header as HeaderT>::Number>, Error>; }
Expand description

Provides the header and block number for a hash.

Decouples sc_client_api::Backend and sp_blockchain::HeaderBackend.

Required Methods§

source

fn header( &self, hash: <Block as BlockT>::Hash, ) -> Result<Option<<Block as BlockT>::Header>, Error>

Obtain the header for a hash.

source

fn number( &self, hash: <Block as BlockT>::Hash, ) -> Result<Option<<<Block as BlockT>::Header as HeaderT>::Number>, Error>

Obtain the block number for a hash.

Implementors§

source§

impl<Block, T> HeaderProvider<Block> for T
where Block: BlockT, T: HeaderBackend<Block> + 'static,