feat: add pending receipts (#3320)

This commit is contained in:
Matthias Seitz
2023-06-22 22:00:16 +02:00
committed by GitHub
parent a4c2f5f69c
commit e8b09cc59b
10 changed files with 98 additions and 20 deletions

View File

@@ -1,6 +1,7 @@
use crate::{blockchain_tree::error::InsertBlockError, Error};
use reth_primitives::{
BlockHash, BlockNumHash, BlockNumber, SealedBlock, SealedBlockWithSenders, SealedHeader,
BlockHash, BlockNumHash, BlockNumber, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader,
};
use std::collections::{BTreeMap, HashSet};
@@ -215,6 +216,14 @@ pub trait BlockchainTreeViewer: Send + Sync {
self.block_by_hash(self.pending_block_num_hash()?.hash)
}
/// Returns the pending receipts if there is one.
fn pending_receipts(&self) -> Option<Vec<Receipt>> {
self.receipts_by_block_hash(self.pending_block_num_hash()?.hash)
}
/// Returns the pending receipts if there is one.
fn receipts_by_block_hash(&self, block_hash: BlockHash) -> Option<Vec<Receipt>>;
/// Returns the pending block if there is one.
fn pending_header(&self) -> Option<SealedHeader> {
self.header_by_hash(self.pending_block_num_hash()?.hash)