dev: block_with_senders on BlockState (#11363)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
greged93
2024-10-01 15:40:09 +02:00
committed by GitHub
parent 6b3a75917e
commit 15e3e0e110
2 changed files with 22 additions and 24 deletions

View File

@ -11,8 +11,8 @@ use reth_chainspec::ChainInfo;
use reth_execution_types::{Chain, ExecutionOutcome};
use reth_metrics::{metrics::Gauge, Metrics};
use reth_primitives::{
Header, Receipt, Receipts, SealedBlock, SealedBlockWithSenders, SealedHeader, TransactionMeta,
TransactionSigned,
BlockWithSenders, Header, Receipt, Receipts, SealedBlock, SealedBlockWithSenders, SealedHeader,
TransactionMeta, TransactionSigned,
};
use reth_storage_api::StateProviderBox;
use reth_trie::{updates::TrieUpdates, HashedPostState};
@ -618,6 +618,20 @@ impl BlockState {
self.block.clone()
}
/// Returns the block with senders for the state.
pub fn block_with_senders(&self) -> BlockWithSenders {
let block = self.block.block().clone();
let senders = self.block.senders().clone();
BlockWithSenders { block: block.unseal(), senders }
}
/// Returns the sealed block with senders for the state.
pub fn sealed_block_with_senders(&self) -> SealedBlockWithSenders {
let block = self.block.block().clone();
let senders = self.block.senders().clone();
SealedBlockWithSenders { block, senders }
}
/// Returns the hash of executed block that determines the state.
pub fn hash(&self) -> B256 {
self.block.block().hash()