Skip to content

Commit d95481f

Browse files
committed
fixes for garbage collect of inactive service transactions + log level adjustments
1 parent 9aa3a25 commit d95481f

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

crates/ethcore/src/client/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,7 @@ impl Client {
15601560
}
15611561
}
15621562

1563-
/// Garbage collect invalid servive transactions from the transaction queue based on the given block header.
1563+
/// Garbage collect invalid service transactions from the transaction queue based on the given block header.
15641564
pub fn garbage_collect_in_queue(&self) {
15651565
let machine = self.engine().machine();
15661566

crates/transaction-pool/src/pool.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
1616

17-
use log::{info, trace, warn};
17+
use log::{debug, trace, warn};
1818
use std::{
1919
collections::{hash_map, BTreeSet, HashMap},
2020
slice,
@@ -236,11 +236,12 @@ where
236236
}
237237
}
238238

239-
/// Performs garbage collection of the pool for free service transactions.
240-
/// Removes transaction that are not valid anymore.
241-
/// The process executes listener calls.
242-
pub fn garbage_collect<F: Fn(&T) -> bool>(&mut self, service_transaction_check: F) {
243-
if self.best_transactions.is_empty() {
239+
/// Performs garbage collection of the pool for free service transactions (zero gas transactions).
240+
/// Only checks lowest nonce.
241+
/// inject "should_keep_function" to decide.
242+
/// The process executes listener calls for invalid transactions.
243+
pub fn garbage_collect<F: Fn(&T) -> bool>(&mut self, should_keep_function: F) {
244+
if self.transactions.is_empty() {
244245
return;
245246
}
246247

@@ -249,7 +250,7 @@ where
249250
for sender in self.transactions.iter() {
250251
for tx in sender.1.iter_transactions() {
251252
if tx.transaction.has_zero_gas_price() {
252-
if service_transaction_check(&tx.transaction) {
253+
if !should_keep_function(&tx.transaction) {
253254
txs_to_remove.push(tx.hash().clone());
254255
}
255256
} else {
@@ -264,7 +265,7 @@ where
264265
return;
265266
}
266267

267-
info!(
268+
debug!(
268269
"Garbage collection: removing invalid {} service transactions from pool.",
269270
txs_to_remove.len()
270271
);

0 commit comments

Comments
 (0)