feat: add helper iter for tx hashes (#13638)

This commit is contained in:
Matthias Seitz
2025-01-04 10:51:00 +01:00
committed by GitHub
parent 9b44e2aaf9
commit 8befda56b0
2 changed files with 6 additions and 1 deletions

View File

@ -41,6 +41,11 @@ pub trait BlockBody:
/// Returns reference to transactions in block.
fn transactions(&self) -> &[Self::Transaction];
/// Returns an iterator over all transaction hashes in the block body.
fn transaction_hashes_iter(&self) -> impl Iterator<Item = &B256> + '_ {
self.transactions().iter().map(|tx| tx.tx_hash())
}
/// Consume the block body and return a [`Vec`] of transactions.
fn into_transactions(self) -> Vec<Self::Transaction>;