Skip to content

Commit

Permalink
perf: call increment once (paradigmxyz#13193)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored and lean-apple committed Dec 11, 2024
1 parent 0bb8715 commit 1cae39d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/transaction-pool/src/pool/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,16 @@ impl<T: TransactionOrdering> TxPool<T> {
self.all_transactions.set_block_info(block_info);

// Remove all transaction that were included in the block
let mut removed_txs_count = 0;
for tx_hash in &mined_transactions {
if self.prune_transaction_by_hash(tx_hash).is_some() {
// Update removed transactions metric
self.metrics.removed_transactions.increment(1);
removed_txs_count += 1;
}
}

// Update removed transactions metric
self.metrics.removed_transactions.increment(removed_txs_count);

let UpdateOutcome { promoted, discarded } = self.update_accounts(changed_senders);

self.update_transaction_type_metrics();
Expand Down

0 comments on commit 1cae39d

Please sign in to comment.