Skip to content

Commit 36e660f

Browse files
committed
Merge bitcoin/bitcoin#29990: fuzz: don't allow adding duplicate transactions to the 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
2 parents ad42d63 + cc15c5b commit 36e660f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/test/fuzz/partially_downloaded_block.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ FUZZ_TARGET(partially_downloaded_block, .init = initialize_pdb)
7272
available.insert(i);
7373
}
7474

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

0 commit comments

Comments
 (0)