Skip to content

Commit f6dec71

Browse files
authored
feat: added Body::contains_transaction(&TxHash) (#16715)
1 parent 448ec7d commit f6dec71

File tree

1 file changed

+7
-0
lines changed
  • crates/primitives-traits/src/block

1 file changed

+7
-0
lines changed

crates/primitives-traits/src/block/body.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ pub trait BlockBody:
6767
self.transactions_iter().find(|tx| tx.tx_hash() == hash)
6868
}
6969

70+
/// Returns true if the block body contains a transaction with the given hash.
71+
///
72+
/// This is a convenience function for `transaction_by_hash().is_some()`
73+
fn contains_transaction(&self, hash: &B256) -> bool {
74+
self.transaction_by_hash(hash).is_some()
75+
}
76+
7077
/// Clones the transactions in the block.
7178
///
7279
/// This is a convenience function for `transactions().to_vec()`

0 commit comments

Comments
 (0)