feat: add helper for accessing pending block object (#2465)

This commit is contained in:
Matthias Seitz
2023-05-01 21:08:43 +02:00
committed by GitHub
parent 7ea801f456
commit 7b1aee2d9c
5 changed files with 37 additions and 9 deletions

View File

@ -105,5 +105,10 @@ pub trait BlockchainTreeViewer: Send + Sync {
/// Return block hashes that extends the canonical chain tip by one.
///
/// If there is no such block, return `None`.
fn pending_block(&self) -> Option<BlockNumHash>;
fn pending_block_num_hash(&self) -> Option<BlockNumHash>;
/// Returns the pending block if there is one.
fn pending_block(&self) -> Option<SealedBlock> {
self.block_by_hash(self.pending_block_num_hash()?.hash)
}
}