[][src]Trait sc_service::client::light::blockchain::BlockchainHeaderBackend

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> { ... } }

Blockchain database header backend. Does not perform any validation.

Required methods

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

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, Error>

Get block status.

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

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

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

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 as Block>::Hash>, Error>

Convert an arbitrary block ID into a block hash.

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

Convert an arbitrary block ID into a block hash.

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

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

fn expect_block_number_from_id(
    &self,
    id: &BlockId<Block>
) -> Result<<<Block as Block>::Header as Header>::Number, Error>

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 as Block>::Hash, Error>

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 LightStorage<Block> where
    Block: Block
[src]

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

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

Loading content...

Implementors

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

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

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

Loading content...