mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor: use BlockWithSenders in executors (#5771)
This commit is contained in:
@ -53,6 +53,11 @@ impl Block {
|
||||
}
|
||||
}
|
||||
|
||||
/// Expensive operation that recovers transaction signer. See [SealedBlockWithSenders].
|
||||
pub fn senders(&self) -> Option<Vec<Address>> {
|
||||
TransactionSigned::recover_signers(&self.body, self.body.len())
|
||||
}
|
||||
|
||||
/// Transform into a [`BlockWithSenders`].
|
||||
///
|
||||
/// # Panics
|
||||
@ -71,6 +76,15 @@ impl Block {
|
||||
BlockWithSenders { block: self, senders }
|
||||
}
|
||||
|
||||
/// **Expensive**. Transform into a [`BlockWithSenders`] by recovering senders in the contained
|
||||
/// transactions.
|
||||
///
|
||||
/// Returns `None` if a transaction is invalid.
|
||||
pub fn with_recovered_senders(self) -> Option<BlockWithSenders> {
|
||||
let senders = self.senders()?;
|
||||
Some(BlockWithSenders { block: self, senders })
|
||||
}
|
||||
|
||||
/// Returns whether or not the block contains any blob transactions.
|
||||
pub fn has_blob_transactions(&self) -> bool {
|
||||
self.body.iter().any(|tx| tx.is_eip4844())
|
||||
|
||||
Reference in New Issue
Block a user