Trait sc_light::blockchain::BlockchainHeaderBackend [−][src]
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]
&self,
id: BlockId<Block>
) -> Result<Option<<Block as Block>::Header>, Error>
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]
&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.
pub fn hash(
&self,
number: <<Block as Block>::Header as Header>::Number
) -> Result<Option<<Block as Block>::Hash>, Error>[src]
&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.
Provided methods
pub fn block_hash_from_id(
&self,
id: &BlockId<Block>
) -> Result<Option<<Block as Block>::Hash>, Error>[src]
&self,
id: &BlockId<Block>
) -> Result<Option<<Block as Block>::Hash>, Error>
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]
&self,
id: &BlockId<Block>
) -> Result<Option<<<Block as Block>::Header as Header>::Number>, Error>
Convert an arbitrary block ID into a block hash.
pub fn expect_header(
&self,
id: BlockId<Block>
) -> Result<<Block as Block>::Header, Error>[src]
&self,
id: BlockId<Block>
) -> Result<<Block as Block>::Header, Error>
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]
&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.
pub fn expect_block_hash_from_id(
&self,
id: &BlockId<Block>
) -> Result<<Block as Block>::Hash, Error>[src]
&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.
Implementations on Foreign Types
impl<Block> HeaderBackend<Block> for Blockchain<Block> where
Block: Block, [src]
Block: Block,
pub fn header(
&self,
id: BlockId<Block>
) -> Result<Option<<Block as Block>::Header>, Error>[src]
&self,
id: BlockId<Block>
) -> Result<Option<<Block as Block>::Header>, Error>
pub fn info(&self) -> Info<Block>[src]
pub fn status(&self, id: BlockId<Block>) -> Result<BlockStatus, Error>[src]
pub fn number(
&self,
hash: <Block as Block>::Hash
) -> Result<Option<<<Block as Block>::Header as Header>::Number>, Error>[src]
&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>[src]
&self,
number: <<Block as Block>::Header as Header>::Number
) -> Result<Option<<Block as Block>::Hash>, Error>
Implementors
impl<S, Block> HeaderBackend<Block> for sc_light::blockchain::Blockchain<S> where
Block: BlockT,
S: Storage<Block>, [src]
Block: BlockT,
S: Storage<Block>,
fn header(&self, id: BlockId<Block>) -> ClientResult<Option<Block::Header>>[src]
fn info(&self) -> BlockchainInfo<Block>[src]
fn status(&self, id: BlockId<Block>) -> ClientResult<BlockStatus>[src]
fn number(&self, hash: Block::Hash) -> ClientResult<Option<NumberFor<Block>>>[src]
fn hash(
&self,
number: <<Block as BlockT>::Header as HeaderT>::Number
) -> ClientResult<Option<Block::Hash>>[src]
&self,
number: <<Block as BlockT>::Header as HeaderT>::Number
) -> ClientResult<Option<Block::Hash>>