chore(txpool): update size metrics on every insert & removal of transactions (#7051)

This commit is contained in:
Roman Krasiuk
2024-03-08 21:13:35 +01:00
committed by GitHub
parent 486945f156
commit 78f9dbda6c

View File

@ -540,6 +540,9 @@ impl<T: TransactionOrdering> TxPool<T> {
AddedTransaction::Parked { transaction, subpool: move_to, replaced }
};
// Update size metrics after adding and potentially moving transactions.
self.update_size_metrics();
Ok(res)
}
Err(err) => {
@ -648,7 +651,10 @@ impl<T: TransactionOrdering> TxPool<T> {
&mut self,
hashes: Vec<TxHash>,
) -> Vec<Arc<ValidPoolTransaction<T::Transaction>>> {
hashes.into_iter().filter_map(|hash| self.remove_transaction_by_hash(&hash)).collect()
let txs =
hashes.into_iter().filter_map(|hash| self.remove_transaction_by_hash(&hash)).collect();
self.update_size_metrics();
txs
}
/// Remove the transaction from the __entire__ pool.