mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add find-transaction-by-hash (#14008)
This commit is contained in:
@ -47,6 +47,13 @@ pub trait BlockBody:
|
||||
self.transactions().iter()
|
||||
}
|
||||
|
||||
/// Returns the transaction with the matching hash.
|
||||
///
|
||||
/// This is a convenience function for `transactions_iter().find()`
|
||||
fn transaction_by_hash(&self, hash: &B256) -> Option<&Self::Transaction> {
|
||||
self.transactions_iter().find(|tx| tx.tx_hash() == hash)
|
||||
}
|
||||
|
||||
/// Clones the transactions in the block.
|
||||
///
|
||||
/// This is a convenience function for `transactions().to_vec()`
|
||||
|
||||
Reference in New Issue
Block a user