feat: add another distance check (#3501)

This commit is contained in:
Matthias Seitz
2023-07-02 13:55:27 +02:00
committed by GitHub
parent d14f995e1a
commit e0d5735672
5 changed files with 42 additions and 2 deletions

View File

@ -172,9 +172,24 @@ pub trait BlockchainTreeViewer: Send + Sync {
/// Returns the block with matching hash from the tree, if it exists.
///
/// Caution: This will not return blocks from the canonical chain.
/// Caution: This will not return blocks from the canonical chain or buffered blocks that are
/// disconnected from the canonical chain.
fn block_by_hash(&self, hash: BlockHash) -> Option<SealedBlock>;
/// Returns the _buffered_ (disconnected) block with matching hash from the internal buffer if
/// it exists.
///
/// Caution: Unlike [Self::block_by_hash] this will only return blocks that are currently
/// disconnected from the canonical chain.
fn buffered_block_by_hash(&self, block_hash: BlockHash) -> Option<SealedBlock>;
/// Returns the _buffered_ (disconnected) header with matching hash from the internal buffer if
/// it exists.
///
/// Caution: Unlike [Self::block_by_hash] this will only return headers that are currently
/// disconnected from the canonical chain.
fn buffered_header_by_hash(&self, block_hash: BlockHash) -> Option<SealedHeader>;
/// Returns true if the tree contains the block with matching hash.
fn contains(&self, hash: BlockHash) -> bool {
self.block_by_hash(hash).is_some()