mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
block_with_senders in ethstatecache (#5302)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@@ -237,6 +237,12 @@ pub trait BlockchainTreeViewer: Send + Sync {
|
||||
/// disconnected from the canonical chain.
|
||||
fn block_by_hash(&self, hash: BlockHash) -> Option<SealedBlock>;
|
||||
|
||||
/// Returns the block with matching hash from the tree, if it exists.
|
||||
///
|
||||
/// Caution: This will not return blocks from the canonical chain or buffered blocks that are
|
||||
/// disconnected from the canonical chain.
|
||||
fn block_with_senders_by_hash(&self, hash: BlockHash) -> Option<SealedBlockWithSenders>;
|
||||
|
||||
/// Returns the _buffered_ (disconnected) block with matching hash from the internal buffer if
|
||||
/// it exists.
|
||||
///
|
||||
@@ -295,6 +301,11 @@ pub trait BlockchainTreeViewer: Send + Sync {
|
||||
self.block_by_hash(self.pending_block_num_hash()?.hash)
|
||||
}
|
||||
|
||||
/// Returns the pending block if there is one.
|
||||
fn pending_block_with_senders(&self) -> Option<SealedBlockWithSenders> {
|
||||
self.block_with_senders_by_hash(self.pending_block_num_hash()?.hash)
|
||||
}
|
||||
|
||||
/// Returns the pending block and its receipts in one call.
|
||||
///
|
||||
/// This exists to prevent a potential data race if the pending block changes in between
|
||||
|
||||
Reference in New Issue
Block a user