[][src]Trait substrate_client::blockchain::HeaderBackend

pub trait HeaderBackend<Block: BlockT>: Send + Sync {
    fn header(&self, id: BlockId<Block>) -> Result<Option<Block::Header>>;
fn info(&self) -> Info<Block>;
fn status(&self, id: BlockId<Block>) -> Result<BlockStatus>;
fn number(
        &self,
        hash: Block::Hash
    ) -> Result<Option<<<Block as BlockT>::Header as HeaderT>::Number>>;
fn hash(&self, number: NumberFor<Block>) -> Result<Option<Block::Hash>>; fn block_hash_from_id(
        &self,
        id: &BlockId<Block>
    ) -> Result<Option<Block::Hash>> { ... }
fn block_number_from_id(
        &self,
        id: &BlockId<Block>
    ) -> Result<Option<NumberFor<Block>>> { ... }
fn expect_header(&self, id: BlockId<Block>) -> Result<Block::Header> { ... }
fn expect_block_number_from_id(
        &self,
        id: &BlockId<Block>
    ) -> Result<NumberFor<Block>> { ... }
fn expect_block_hash_from_id(
        &self,
        id: &BlockId<Block>
    ) -> Result<Block::Hash> { ... } }

Blockchain database header backend. Does not perform any validation.

Required methods

fn header(&self, id: BlockId<Block>) -> Result<Option<Block::Header>>

Get block header. Returns None if block is not found.

fn info(&self) -> Info<Block>

Get blockchain info.

fn status(&self, id: BlockId<Block>) -> Result<BlockStatus>

Get block status.

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

Get block number by hash. Returns None if the header is not in the chain.

fn hash(&self, number: NumberFor<Block>) -> Result<Option<Block::Hash>>

Get block hash by number. Returns None if the header is not in the chain.

Loading content...

Provided methods

fn block_hash_from_id(&self, id: &BlockId<Block>) -> Result<Option<Block::Hash>>

Convert an arbitrary block ID into a block hash.

fn block_number_from_id(
    &self,
    id: &BlockId<Block>
) -> Result<Option<NumberFor<Block>>>

Convert an arbitrary block ID into a block hash.

fn expect_header(&self, id: BlockId<Block>) -> Result<Block::Header>

Get block header. Returns UnknownBlock error if block is not found.

fn expect_block_number_from_id(
    &self,
    id: &BlockId<Block>
) -> Result<NumberFor<Block>>

Convert an arbitrary block ID into a block number. Returns UnknownBlock error if block is not found.

fn expect_block_hash_from_id(&self, id: &BlockId<Block>) -> Result<Block::Hash>

Convert an arbitrary block ID into a block hash. Returns UnknownBlock error if block is not found.

Loading content...

Implementors

impl<'_, B, E, Block, RA> HeaderBackend<Block> for &'_ Client<B, E, Block, RA> where
    B: Backend<Block, Blake2Hasher>,
    E: CallExecutor<Block, Blake2Hasher> + Send + Sync,
    Block: BlockT<Hash = H256>,
    RA: Send + Sync
[src]

impl<B, E, Block, RA> HeaderBackend<Block> for Client<B, E, Block, RA> where
    B: Backend<Block, Blake2Hasher>,
    E: CallExecutor<Block, Blake2Hasher> + Send + Sync,
    Block: BlockT<Hash = H256>,
    RA: Send + Sync
[src]

impl<Block: BlockT> HeaderBackend<Block> for substrate_client::in_mem::Blockchain<Block>[src]

impl<S, Block> HeaderBackend<Block> for substrate_client::light::blockchain::Blockchain<S> where
    Block: BlockT,
    S: Storage<Block>, 
[src]

Loading content...