Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger committed Oct 28, 2024
1 parent d0b8169 commit 6afc92d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pool/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,18 +363,18 @@ where
// Prune transactions that have been in the mempool for more than 5 minutes
let now = Instant::now();

for (tx_hash, timestamp) in &mempool_transactions.clone() {
for (tx_hash, timestamp) in mempool_transactions.clone() {
// - If the transaction has been in the mempool for more than 5 minutes
// - And the transaction is in the mempool right now
if now.duration_since(*timestamp) > prune_duration && eth_client.mempool().contains(tx_hash)
if now.duration_since(timestamp) > prune_duration && eth_client.mempool().contains(&tx_hash)
{
tracing::warn!("Transaction {} in mempool for more than 5 minutes. Pruning.", tx_hash);

// Add the transaction to the mined transactions so that it can be pruned
mined_transactions.push(*tx_hash);
mined_transactions.push(tx_hash);

// Remove the transaction from the mempool mapping
mempool_transactions.remove(tx_hash);
mempool_transactions.remove(&tx_hash);
}
}

Expand Down

0 comments on commit 6afc92d

Please sign in to comment.