diff --git a/crates/transaction-pool/src/pool/pending.rs b/crates/transaction-pool/src/pool/pending.rs index 39646e0b1138..0f852f008500 100644 --- a/crates/transaction-pool/src/pool/pending.rs +++ b/crates/transaction-pool/src/pool/pending.rs @@ -340,9 +340,10 @@ impl PendingPool { self.independent_transactions.remove(&tx); // switch out for the next ancestor if there is one - self.highest_nonces.remove(&tx); - if let Some(ancestor) = self.ancestor(id) { - self.highest_nonces.insert(ancestor.clone()); + if self.highest_nonces.remove(&tx) { + if let Some(ancestor) = self.ancestor(id) { + self.highest_nonces.insert(ancestor.clone()); + } } Some(tx.transaction) }