Skip to content

Commit

Permalink
Merge #29990: fuzz: don't allow adding duplicate transactions to the …
Browse files Browse the repository at this point in the history
…mempool

cc15c5b fuzz: don't allow adding duplicate transactions to the mempool (Suhas Daftuar)

Pull request description:

  Filter duplicate transaction ids from being added to the mempool in the `partially_downloaded_block` fuzz target.

  I think a prerequisite for calling `CTxMemPool::addUnchecked` should be that the underlying txid doesn't already exist in the mempool (otherwise `addUnchecked` would need a way to return failure, which we don't currently have).

ACKs for top commit:
  glozow:
    utACK cc15c5b makes sense to me
  maflcko:
    lgtm ACK cc15c5b
  brunoerg:
    ACK cc15c5b
  dergoegge:
    utACK cc15c5b

Tree-SHA512: 85f84ce405aba584e6d00391515f0a86c5648ce8b2da69036e50a6c1f6833d050d09b1972cc5ffbe7c4edb3e5f7f965ef34bd839deeddac27a889cc8d2e53b8f
  • Loading branch information
glozow committed Apr 30, 2024
2 parents ad42d63 + cc15c5b commit 36e660f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/test/fuzz/partially_downloaded_block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ FUZZ_TARGET(partially_downloaded_block, .init = initialize_pdb)
available.insert(i);
}

if (add_to_mempool) {
if (add_to_mempool && !pool.exists(GenTxid::Txid(tx->GetHash()))) {
LOCK2(cs_main, pool.cs);
pool.addUnchecked(ConsumeTxMemPoolEntry(fuzzed_data_provider, *tx));
available.insert(i);
Expand Down

0 comments on commit 36e660f

Please sign in to comment.