Skip to content

Commit

Permalink
Prevent duplicate history events
Browse files Browse the repository at this point in the history
  • Loading branch information
junderw committed May 1, 2024
1 parent c2445a3 commit 9e0ecad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/new_index/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,12 @@ impl Mempool {
// Phase 1: add to txstore
for tx in txs {
let txid = tx.txid();
txids.push(txid);
self.txstore.insert(txid, tx);
// Only push if it doesn't already exist.
// This is important now that update doesn't lock during
// the entire function body.
if self.txstore.insert(txid, tx).is_none() {
txids.push(txid);
}
}

// Phase 2: index history and spend edges (some txos can be missing)
Expand Down

0 comments on commit 9e0ecad

Please sign in to comment.