Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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
},
});
Expand Down
17 changes: 9 additions & 8 deletions crates/transaction-pool/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

use log::{info, trace, warn};
use log::{debug, trace, warn};
use std::{
collections::{hash_map, BTreeSet, HashMap},
slice,
Expand Down Expand Up @@ -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<F: Fn(&T) -> 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.
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment "Only checks lowest nonce" is misleading. The function actually checks all consecutive zero-gas-price transactions starting from the lowest nonce until it encounters a non-zero gas price transaction. Consider updating to: "Checks consecutive zero-gas-price transactions starting from the lowest nonce."

Suggested change
/// Only checks lowest nonce.
/// Checks consecutive zero-gas-price transactions starting from the lowest nonce.

Copilot uses AI. Check for mistakes.
/// inject "should_keep_function" to decide.
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says "inject 'should_keep_function' to decide" but should use proper capitalization and clearer phrasing. Consider: "Inject should_keep_function to determine which transactions to keep."

Suggested change
/// inject "should_keep_function" to decide.
/// Inject should_keep_function to determine which transactions to keep.

Copilot uses AI. Check for mistakes.
/// The process executes listener calls for invalid transactions.
pub fn garbage_collect<F: Fn(&T) -> bool>(&mut self, should_keep_function: F) {
if self.transactions.is_empty() {
return;
}

Expand All @@ -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 {
Expand All @@ -264,7 +265,7 @@ where
return;
}

info!(
debug!(
"Garbage collection: removing invalid {} service transactions from pool.",
txs_to_remove.len()
);
Expand Down
Loading