feat: add transactions_recovered iter (#13903)

This commit is contained in:
Matthias Seitz
2025-01-21 16:49:00 +01:00
committed by GitHub
parent 6dabd5244e
commit b0b1d9d8df
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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`