Merge bitcoin/bitcoin#29990: fuzz: don't allow adding duplicate transactions to the mempool

cc15c5bfd1 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 cc15c5bfd1 makes sense to me
  maflcko:
    lgtm ACK cc15c5bfd1
  brunoerg:
    ACK cc15c5bfd1
  dergoegge:
    utACK cc15c5bfd1

Tree-SHA512: 85f84ce405aba584e6d00391515f0a86c5648ce8b2da69036e50a6c1f6833d050d09b1972cc5ffbe7c4edb3e5f7f965ef34bd839deeddac27a889cc8d2e53b8f
This commit is contained in:
glozow 2024-04-30 09:50:03 +01:00
commit 36e660fc23
No known key found for this signature in database
GPG Key ID: BA03F4DBE0C63FB4
1 changed files with 1 additions and 1 deletions

View File

@ -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);