diff --git a/crates/primitives/src/block.rs b/crates/primitives/src/block.rs
index 2d820734d50d..a432cdbc2089 100644
--- a/crates/primitives/src/block.rs
+++ b/crates/primitives/src/block.rs
@@ -102,6 +102,34 @@ impl BlockWithSenders {
pub fn into_components(self) -> (Block, Vec
) {
(self.block, self.senders)
}
+
+ /// Returns an iterator over all transactions in the block.
+ #[inline]
+ pub fn transactions(&self) -> impl Iterator- + '_ {
+ self.block.body.iter()
+ }
+
+ /// Returns an iterator over all transactions and their sender.
+ #[inline]
+ pub fn transactions_with_sender(
+ &self,
+ ) -> impl Iterator
- + '_ {
+ self.senders.iter().zip(self.block.body.iter())
+ }
+
+ /// Consumes the block and returns the transactions of the block.
+ #[inline]
+ pub fn into_transactions(self) -> Vec {
+ self.block.body
+ }
+
+ /// Returns an iterator over all transactions in the chain.
+ #[inline]
+ pub fn into_transactions_ecrecovered(
+ self,
+ ) -> impl Iterator
- {
+ self.block.body.into_iter().zip(self.senders).map(|(tx, sender)| tx.with_signer(sender))
+ }
}
impl Deref for BlockWithSenders {