From d95481f8373f65f98a99ceda6c7a15ea7b90391e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 10 Dec 2025 19:18:57 +0100 Subject: [PATCH 1/2] fixes for garbage collect of inactive service transactions + log level adjustments --- crates/ethcore/src/client/client.rs | 2 +- crates/transaction-pool/src/pool.rs | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/crates/ethcore/src/client/client.rs b/crates/ethcore/src/client/client.rs index 9410070b3..ba9f0f767 100644 --- a/crates/ethcore/src/client/client.rs +++ b/crates/ethcore/src/client/client.rs @@ -1560,7 +1560,7 @@ impl Client { } } - /// Garbage collect invalid servive transactions from the transaction queue based on the given block header. + /// Garbage collect invalid service transactions from the transaction queue based on the given block header. pub fn garbage_collect_in_queue(&self) { let machine = self.engine().machine(); diff --git a/crates/transaction-pool/src/pool.rs b/crates/transaction-pool/src/pool.rs index abea527ba..caa4d9c43 100644 --- a/crates/transaction-pool/src/pool.rs +++ b/crates/transaction-pool/src/pool.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Parity. If not, see . -use log::{info, trace, warn}; +use log::{debug, trace, warn}; use std::{ collections::{hash_map, BTreeSet, HashMap}, slice, @@ -236,11 +236,12 @@ where } } - /// Performs garbage collection of the pool for free service transactions. - /// Removes transaction that are not valid anymore. - /// The process executes listener calls. - pub fn garbage_collect bool>(&mut self, service_transaction_check: F) { - if self.best_transactions.is_empty() { + /// Performs garbage collection of the pool for free service transactions (zero gas transactions). + /// Only checks lowest nonce. + /// inject "should_keep_function" to decide. + /// The process executes listener calls for invalid transactions. + pub fn garbage_collect bool>(&mut self, should_keep_function: F) { + if self.transactions.is_empty() { return; } @@ -249,7 +250,7 @@ where for sender in self.transactions.iter() { for tx in sender.1.iter_transactions() { if tx.transaction.has_zero_gas_price() { - if service_transaction_check(&tx.transaction) { + if !should_keep_function(&tx.transaction) { txs_to_remove.push(tx.hash().clone()); } } else { @@ -264,7 +265,7 @@ where return; } - info!( + debug!( "Garbage collection: removing invalid {} service transactions from pool.", txs_to_remove.len() ); From 9b10f1c3141858e03f8279aea7b469c070ea0148 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 10 Dec 2025 19:19:16 +0100 Subject: [PATCH 2/2] log level for collect garbage --- crates/ethcore/src/client/client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ethcore/src/client/client.rs b/crates/ethcore/src/client/client.rs index ba9f0f767..43e52b75e 100644 --- a/crates/ethcore/src/client/client.rs +++ b/crates/ethcore/src/client/client.rs @@ -1589,7 +1589,7 @@ impl Client { match machine.verify_transaction(tx.signed(), block_header, self) { Ok(_) => true, Err(e) => { - info!(target: "client", "collected garbage transaction from {:?}: {:?} reason: {:?}", tx.signed().sender(), tx.signed().hash, e); + trace!(target: "client", "collected garbage transaction from {:?}: {:?} reason: {:?}", tx.signed().sender(), tx.signed().hash, e); false }, });