Skip to content

Commit

Permalink
feat(mempool): insert eligible tx to tx queue in commit-block accordi…
Browse files Browse the repository at this point in the history
…ng to state changes
  • Loading branch information
MohammadNassar1 committed Jul 14, 2024
1 parent 9986c59 commit 554b01f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions crates/mempool/src/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,17 @@ impl Mempool {
self.tx_queue.remove(address);
}
// TODO: remove the transactions from the tx_pool.

// Insert an eligible transaction into the queue with a nonce matching the state
// changes. This is applicable when the block originates from a different
// leader.
if self.tx_queue.get_nonce(address).is_none() {
if let Some(tx) = self.tx_pool.get_by_address_and_nonce(address, nonce) {
self.tx_queue.insert(*tx);
}
}
}
// TODO: update the tx_queue with the new state changes.
todo!()
Ok(())
}

fn insert_tx(&mut self, input: MempoolInput) -> MempoolResult<()> {
Expand Down

0 comments on commit 554b01f

Please sign in to comment.