Skip to content

Commit

Permalink
Ignore duplicate entry in addUnchecked
Browse files Browse the repository at this point in the history
Fixes fuzzing
  • Loading branch information
theuni committed Oct 30, 2023
1 parent f224811 commit dec72b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,12 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces
// all the appropriate checks.

auto emplaced = mapTx.emplace(entry, std::make_unique<mempool_iters>());
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);
Expand Down

0 comments on commit dec72b1

Please sign in to comment.