diff --git a/crates/primitives-traits/src/block/recovered.rs b/crates/primitives-traits/src/block/recovered.rs index c565691dc6..44631cd38e 100644 --- a/crates/primitives-traits/src/block/recovered.rs +++ b/crates/primitives-traits/src/block/recovered.rs @@ -283,6 +283,15 @@ impl RecoveredBlock { (self.block.into_block(), self.senders) } + /// Returns the `Recovered<&T>` transaction at the given index. + pub fn recovered_transaction( + &self, + idx: usize, + ) -> Option::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(