feat: add get_recovered_transaction helper (#16436)

This commit is contained in:
Matthias Seitz
2025-05-23 15:21:04 +02:00
committed by GitHub
parent ecbdf45654
commit 4e6cba3324

View File

@@ -283,6 +283,15 @@ impl<B: Block> RecoveredBlock<B> {
(self.block.into_block(), self.senders)
}
/// Returns the `Recovered<&T>` transaction at the given index.
pub fn recovered_transaction(
&self,
idx: usize,
) -> Option<Recovered<&<B::Body as BlockBody>::Transaction>> {
let sender = self.senders.get(idx).copied()?;
self.block.body().transactions().get(idx).map(|tx| Recovered::new_unchecked(tx, sender))
}
/// Returns an iterator over all transactions and their sender.
#[inline]
pub fn transactions_with_sender(