From 70e2fd5fb5a59ed43245522987b1daff02ed7bf4 Mon Sep 17 00:00:00 2001 From: int88 <106391185+int88@users.noreply.github.com> Date: Sat, 26 Apr 2025 23:17:01 +0800 Subject: [PATCH] chore: dedup `prune_from_subpool` (#15945) --- crates/transaction-pool/src/pool/txpool.rs | 26 +--------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/crates/transaction-pool/src/pool/txpool.rs b/crates/transaction-pool/src/pool/txpool.rs index f3ac4111ba..cb5f65fb31 100644 --- a/crates/transaction-pool/src/pool/txpool.rs +++ b/crates/transaction-pool/src/pool/txpool.rs @@ -847,7 +847,7 @@ impl TxPool { tx_hash: &B256, ) -> Option>> { let (tx, pool) = self.all_transactions.remove_transaction_by_hash(tx_hash)?; - self.prune_from_subpool(pool, tx.id()) + self.remove_from_subpool(pool, tx.id()) } /// Removes the transaction from the given pool. @@ -875,30 +875,6 @@ impl TxPool { tx } - /// Removes the transaction from the given pool and advance sub-pool internal state, with the - /// expectation that the given transaction is included in a block. - fn prune_from_subpool( - &mut self, - pool: SubPool, - tx: &TransactionId, - ) -> Option>> { - let tx = match pool { - SubPool::Pending => self.pending_pool.remove_transaction(tx), - SubPool::Queued => self.queued_pool.remove_transaction(tx), - SubPool::BaseFee => self.basefee_pool.remove_transaction(tx), - SubPool::Blob => self.blob_pool.remove_transaction(tx), - }; - - if let Some(ref tx) = tx { - // We trace here instead of in subpool structs directly, because the `ParkedPool` type - // is generic and it would not be possible to distinguish whether a transaction is - // being pruned from the `BaseFee` pool, or the `Queued` pool. - trace!(target: "txpool", hash=%tx.transaction.hash(), ?pool, "Pruned transaction from a subpool"); - } - - tx - } - /// Removes _only_ the descendants of the given transaction from the __entire__ pool. /// /// All removed transactions are added to the `removed` vec.