mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-21 14:34:49 +01: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:
parent
29eb219c12
commit
f4254e2098
1 changed files with 2 additions and 1 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue