Trait sc_light::blockchain::BlockchainHeaderBackend[][src]

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

Blockchain database header backend. Does not perform any validation.

Required methods

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

Get blockchain info.

Get block status.

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

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

Provided methods

Convert an arbitrary block ID into a block hash.

Convert an arbitrary block ID into a block hash.

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

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

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

Implementations on Foreign Types

Implementors