Skip to content

Commit

Permalink
Bugfix in mempool cleanup procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
keyvank committed Jun 14, 2023
1 parent 88aadd6 commit ec258fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bazuka"
version = "0.19.15"
version = "0.19.16"
authors = ["El Geuse <[email protected]>"]
edition = "2021"

Expand Down
7 changes: 5 additions & 2 deletions src/blockchain/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,12 @@ impl SingleMempool {
self.nonce + 1 == tx.nonce()
}
}
fn insert(&mut self, tx: GeneralTransaction, stats: TransactionStats) {
fn insert(&mut self, tx: GeneralTransaction, stats: TransactionStats, now: u32) {
if self.applicable(&tx) {
self.txs.push_back((tx, stats));
if self.last_exec == 0 {
self.last_exec = now;
}
}
}
fn update_nonce(&mut self, nonce: u32, now: u32) {
Expand Down Expand Up @@ -299,7 +302,7 @@ impl Mempool {
.or_insert(SingleMempool::new(nonce));

if is_local || all.len() < limit {
all.insert(tx.clone(), TransactionStats::new(is_local, now, meta));
all.insert(tx.clone(), TransactionStats::new(is_local, now, meta), now);
}
Ok(())
}
Expand Down

0 comments on commit ec258fd

Please sign in to comment.