reinsert in correct order
@@ -249,7 +249,7 @@ impl Mempool {
fn prepare_tx_for_block(&mut self, mut chunks_left: usize) -> (usize, Vec<FranklinTx>) {
let mut txs_for_commit = Vec::new();
- let mut txs_for_reinsert = VecDeque::new();
+ let mut tx_for_reinsert = None;
while let Some(tx) = self.mempool_state.ready_txs.pop_front() {
let chunks_for_tx = self.mempool_state.chunks_for_tx(&tx);
@@ -257,12 +257,14 @@ impl Mempool {
txs_for_commit.push(tx);
chunks_left -= chunks_for_tx;
} else {
- txs_for_reinsert.push_back(tx);
+ tx_for_reinsert = Some(tx);
break;
}
}
- self.mempool_state.ready_txs.append(&mut txs_for_reinsert);
+ if let Some(tx) = tx_for_reinsert {
+ self.mempool_state.ready_txs.push_front(tx);
+ }
(chunks_left, txs_for_commit)
}
