mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor(tx-pool): small refactor for contains_conflicting_transaction (#11935)
This commit is contained in:
@ -1405,12 +1405,9 @@ impl<T: PoolTransaction> AllTransactions<T> {
|
||||
/// Caution: This assumes that mutually exclusive invariant is always true for the same sender.
|
||||
#[inline]
|
||||
fn contains_conflicting_transaction(&self, tx: &ValidPoolTransaction<T>) -> bool {
|
||||
let mut iter = self.txs_iter(tx.transaction_id.sender);
|
||||
if let Some((_, existing)) = iter.next() {
|
||||
return tx.tx_type_conflicts_with(&existing.transaction)
|
||||
}
|
||||
// no existing transaction for this sender
|
||||
false
|
||||
self.txs_iter(tx.transaction_id.sender)
|
||||
.next()
|
||||
.map_or(false, |(_, existing)| tx.tx_type_conflicts_with(&existing.transaction))
|
||||
}
|
||||
|
||||
/// Additional checks for a new transaction.
|
||||
|
||||
Reference in New Issue
Block a user