[][src]Trait sp_blockchain::HeaderBackend

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

Blockchain database header backend. Does not perform any validation.

Required methods

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

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

pub fn info(&self) -> Info<Block>[src]

Get blockchain info.

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

Get block status.

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

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

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

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

Loading content...

Provided methods

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

Convert an arbitrary block ID into a block hash.

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

Convert an arbitrary block ID into a block hash.

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

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

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

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

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

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

Loading content...

Implementors

Loading content...