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

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

Blockchain database header backend. Does not perform any validation.

Required methods

pub fn header(
    &self,
    id: BlockId<Block>
) -> Result<Option<<Block as Block>::Header>, Error>
[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, Error>[src]

Get block status.

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

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

pub fn hash(
    &self,
    number: <<Block as Block>::Header as Header>::Number
) -> Result<Option<<Block as Block>::Hash>, Error>
[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 as Block>::Hash>, Error>
[src]

Convert an arbitrary block ID into a block hash.

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

Convert an arbitrary block ID into a block hash.

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

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

pub fn expect_block_number_from_id(
    &self,
    id: &BlockId<Block>
) -> Result<<<Block as Block>::Header as Header>::Number, Error>
[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 as Block>::Hash, Error>
[src]

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

Loading content...

Implementations on Foreign Types

impl<Block> HeaderBackend<Block> for Blockchain<Block> where
    Block: Block
[src]

Loading content...

Implementors

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

Loading content...