diff --git a/crates/mempool/src/transaction_queue.rs b/crates/mempool/src/transaction_queue.rs index fca186f0..ddcbb9ab 100644 --- a/crates/mempool/src/transaction_queue.rs +++ b/crates/mempool/src/transaction_queue.rs @@ -55,6 +55,15 @@ impl TransactionQueue { pub fn _get_nonce(&self, address: ContractAddress) -> Option { self.address_to_tx.get(&address).map(|tx| tx.nonce) } + + /// Removes the transaction of the given account address from the queue. + /// This is well-defined, since there is at most one transaction per address in the queue. + pub fn _remove(&mut self, address: ContractAddress) -> bool { + if let Some(tx) = self.address_to_tx.remove(&address) { + return self.queue.remove(&tx.into()); + } + false + } } /// Encapsulates a transaction reference to assess its order (i.e., priority).