diff --git a/crates/ethcore/src/client/client.rs b/crates/ethcore/src/client/client.rs index 9410070b3..43e52b75e 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(); @@ -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 }, }); 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() );