mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 06:48:01 +00:00
add leaves function to chain (#1154)
This commit is contained in:
committed by
GitHub
parent
41aec063df
commit
2e41e9e870
@@ -93,6 +93,9 @@ pub trait BlockchainEvents<Block: BlockT> {
|
||||
pub trait ChainHead<Block: BlockT> {
|
||||
/// Get best block header.
|
||||
fn best_block_header(&self) -> Result<<Block as BlockT>::Header, error::Error>;
|
||||
/// Get all leaves of the chain: block hashes that have no children currently.
|
||||
/// Leaves that can never be finalized will not be returned.
|
||||
fn leaves(&self) -> Result<Vec<<Block as BlockT>::Hash>, error::Error>;
|
||||
}
|
||||
|
||||
/// Fetch block body by ID.
|
||||
@@ -1189,6 +1192,10 @@ where
|
||||
fn best_block_header(&self) -> error::Result<<Block as BlockT>::Header> {
|
||||
Client::best_block_header(self)
|
||||
}
|
||||
|
||||
fn leaves(&self) -> Result<Vec<<Block as BlockT>::Hash>, error::Error> {
|
||||
self.backend.blockchain().leaves()
|
||||
}
|
||||
}
|
||||
|
||||
impl<B, E, Block, RA> BlockBody<Block> for Client<B, E, Block, RA>
|
||||
|
||||
Reference in New Issue
Block a user