diff --git a/crates/mempool/src/mempool.rs b/crates/mempool/src/mempool.rs index 9774ca292..f9e545b8f 100644 --- a/crates/mempool/src/mempool.rs +++ b/crates/mempool/src/mempool.rs @@ -1,5 +1,5 @@ use std::collections::hash_map::Entry::{Occupied, Vacant}; -use std::collections::{BTreeMap, HashMap}; +use std::collections::{BTreeMap, BTreeSet, HashMap}; use anyhow::Result; use mempool_infra::network_component::CommunicationInterface; @@ -25,6 +25,7 @@ pub struct Mempool { txs_queue: TransactionPriorityQueue, tx_store: HashMap>, tx_hash_2_tx: HashMap, + staging: BTreeSet, state: HashMap, } @@ -39,6 +40,7 @@ impl Mempool { tx_store: HashMap::default(), state: HashMap::default(), tx_hash_2_tx: HashMap::default(), + staging: BTreeSet::default(), gateway_network, batcher_network, }; @@ -87,6 +89,7 @@ impl Mempool { let mut txs: Vec = Vec::default(); for pq_tx in &pq_txs { + self.staging.insert(pq_tx.tx_hash); let tx = self.tx_hash_2_tx.remove(&pq_tx.tx_hash).unwrap(); self.state.remove(&tx.sender_address); self.tx_store.remove(&tx.sender_address);