mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-14 09:33:04 +02:00
assume duplicate transactions are not added to iters_by_txid
In `AddTransactionsToBlock` description comment we have the asuumption that callers will never pass multiple transactions with the same txid We are asserting to assume that does not happen.
This commit is contained in:
@ -51,7 +51,8 @@ size_t DisconnectedBlockTransactions::DynamicMemoryUsage() const
|
||||
iters_by_txid.reserve(iters_by_txid.size() + vtx.size());
|
||||
for (auto block_it = vtx.rbegin(); block_it != vtx.rend(); ++block_it) {
|
||||
auto it = queuedTx.insert(queuedTx.end(), *block_it);
|
||||
iters_by_txid.emplace((*block_it)->GetHash(), it);
|
||||
auto [_, inserted] = iters_by_txid.emplace((*block_it)->GetHash(), it);
|
||||
assert(inserted); // callers may never pass multiple transactions with the same txid
|
||||
cachedInnerUsage += RecursiveDynamicUsage(**block_it);
|
||||
}
|
||||
return LimitMemoryUsage();
|
||||
|
Reference in New Issue
Block a user