Skip to content

Commit

Permalink
feat: add transactions_recovered iter (paradigmxyz#13903)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 21, 2025
1 parent 6dabd52 commit b0b1d9d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions crates/primitives-traits/src/block/recovered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,17 @@ impl<B: Block> RecoveredBlock<B> {
self.senders.iter().zip(self.block.body().transactions())
}

/// Returns an iterator over all transactions in the block.
/// Returns an iterator over `Recovered<&Transaction>`
#[inline]
pub fn into_transactions_ecrecovered(
pub fn transactions_recovered(
&self,
) -> impl Iterator<Item = Recovered<&'_ <B::Body as BlockBody>::Transaction>> {
self.transactions_with_sender().map(|(sender, tx)| Recovered::new_unchecked(tx, *sender))
}

/// Consumes the type and returns an iterator over all [`Recovered`] transactions in the block.
#[inline]
pub fn into_transactions_recovered(
self,
) -> impl Iterator<Item = Recovered<<B::Body as BlockBody>::Transaction>> {
self.block
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ where
.block_with_senders_by_id(block_id, TransactionVariant::NoHash)
.to_rpc_result()?
.unwrap_or_default();
Ok(block.into_transactions_ecrecovered().map(|tx| tx.encoded_2718().into()).collect())
Ok(block.into_transactions_recovered().map(|tx| tx.encoded_2718().into()).collect())
}

/// Handler for `debug_getRawReceipts`
Expand Down

0 comments on commit b0b1d9d

Please sign in to comment.