From dec72b13207baf044243fdf6866f16ff1377e574 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Mon, 30 Oct 2023 19:47:45 +0000 Subject: [PATCH] Ignore duplicate entry in addUnchecked Fixes fuzzing --- src/txmempool.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index a05e705d724ff..ab02f03840ab5 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -605,8 +605,12 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces // all the appropriate checks. auto emplaced = mapTx.emplace(entry, std::make_unique()); + if (!emplaced.second) { + // TODO: Investigate: this shouldn't be possible but happens + // when fuzzing partially_downloaded_block. + return; + } auto newit = emplaced.first; - assert(emplaced.second); const auto& inserted = newit->second; assert(inserted); iters_by_txid.emplace(entry.GetTx().GetHash(), newit);