Trait sc_light::blockchain::BlockchainBackend [−][src]
Blockchain database backend. Does not perform any validation.
Required methods
pub fn body(
&self,
id: BlockId<Block>
) -> Result<Option<Vec<<Block as Block>::Extrinsic, Global>>, Error>
[src]
&self,
id: BlockId<Block>
) -> Result<Option<Vec<<Block as Block>::Extrinsic, Global>>, Error>
Get block body. Returns None
if block is not found.
pub fn justification(
&self,
id: BlockId<Block>
) -> Result<Option<Vec<u8, Global>>, Error>
[src]
&self,
id: BlockId<Block>
) -> Result<Option<Vec<u8, Global>>, Error>
Get block justification. Returns None
if justification does not exist.
pub fn last_finalized(&self) -> Result<<Block as Block>::Hash, Error>
[src]
Get last finalized block hash.
pub fn cache(&self) -> Option<Arc<dyn Cache<Block> + 'static>>
[src]
Returns data cache reference, if it is enabled on this backend.
pub fn leaves(&self) -> Result<Vec<<Block as Block>::Hash, Global>, Error>
[src]
Returns hashes of all blocks that are leaves of the block tree. in other words, that have no children, are chain heads. Results must be ordered best (longest, highest) chain first.
pub fn children(
&self,
parent_hash: <Block as Block>::Hash
) -> Result<Vec<<Block as Block>::Hash, Global>, Error>
[src]
&self,
parent_hash: <Block as Block>::Hash
) -> Result<Vec<<Block as Block>::Hash, Global>, Error>
Return hashes of all blocks that are children of the block with parent_hash
.
Provided methods
pub fn best_containing(
&self,
target_hash: <Block as Block>::Hash,
maybe_max_number: Option<<<Block as Block>::Header as Header>::Number>,
import_lock: &RwLock<RawRwLock, ()>
) -> Result<Option<<Block as Block>::Hash>, Error>
[src]
&self,
target_hash: <Block as Block>::Hash,
maybe_max_number: Option<<<Block as Block>::Header as Header>::Number>,
import_lock: &RwLock<RawRwLock, ()>
) -> Result<Option<<Block as Block>::Hash>, Error>
Get the most recent block hash of the best (longest) chains
that contain block with the given target_hash
.
The search space is always limited to blocks which are in the finalized chain or descendents of it.
If maybe_max_block_number
is Some(max_block_number)
the search is limited to block numbers <= max_block_number
.
in other words as if there were no blocks greater max_block_number
.
Returns Ok(None)
if target_hash
is not found in search space.
TODO: document time complexity of this, see #1444
Implementations on Foreign Types
impl<Block> Backend<Block> for Blockchain<Block> where
Block: Block,
[src]
Block: Block,
pub fn body(
&self,
id: BlockId<Block>
) -> Result<Option<Vec<<Block as Block>::Extrinsic, Global>>, Error>
[src]
&self,
id: BlockId<Block>
) -> Result<Option<Vec<<Block as Block>::Extrinsic, Global>>, Error>
pub fn justification(
&self,
id: BlockId<Block>
) -> Result<Option<Vec<u8, Global>>, Error>
[src]
&self,
id: BlockId<Block>
) -> Result<Option<Vec<u8, Global>>, Error>
pub fn last_finalized(&self) -> Result<<Block as Block>::Hash, Error>
[src]
pub fn cache(&self) -> Option<Arc<dyn Cache<Block> + 'static>>
[src]
pub fn leaves(&self) -> Result<Vec<<Block as Block>::Hash, Global>, Error>
[src]
pub fn children(
&self,
_parent_hash: <Block as Block>::Hash
) -> Result<Vec<<Block as Block>::Hash, Global>, Error>
[src]
&self,
_parent_hash: <Block as Block>::Hash
) -> Result<Vec<<Block as Block>::Hash, Global>, Error>
Implementors
impl<S, Block> Backend<Block> for sc_light::blockchain::Blockchain<S> where
Block: BlockT,
S: Storage<Block>,
[src]
Block: BlockT,
S: Storage<Block>,
fn body(
&self,
_id: BlockId<Block>
) -> ClientResult<Option<Vec<Block::Extrinsic>>>
[src]
&self,
_id: BlockId<Block>
) -> ClientResult<Option<Vec<Block::Extrinsic>>>
fn justification(
&self,
_id: BlockId<Block>
) -> ClientResult<Option<Justification>>
[src]
&self,
_id: BlockId<Block>
) -> ClientResult<Option<Justification>>