Skip to content

Commit

Permalink
feat(mempool): implement remove method for transaction queue
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammadNassar1 committed Jul 9, 2024
1 parent 3d2f02c commit 8723580
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/mempool/src/transaction_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ impl TransactionQueue {
pub fn _get_nonce(&self, address: &ContractAddress) -> Option<&Nonce> {
self.address_to_tx.get(address).map(|tx| &tx.nonce)
}


/// At most one transaction is associated with a single address in the queue.
pub fn _remove(mut self, address: &ContractAddress) -> Option<TransactionReference> {
self.address_to_tx.remove(address).map(|tx| {
self.queue.remove(&tx.into());
tx
})
}
}

#[derive(Clone, Debug, derive_more::Deref, derive_more::From)]
Expand Down

0 comments on commit 8723580

Please sign in to comment.