diff options
author | ismaelsadeeq <ask4ismailsadiq@gmail.com> | 2023-10-05 11:45:07 +0100 |
---|---|---|
committer | ismaelsadeeq <ask4ismailsadiq@gmail.com> | 2023-10-18 15:31:51 +0100 |
commit | f4254e209801d6a790b5f0c251c0b32154a4e3cc (patch) | |
tree | 3a31b352e054cb7d2b6c8eb7918ce85c74880231 /src/kernel | |
parent | 29eb219c1247993378fce06c8f71aab20736c237 (diff) |
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.
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/disconnected_transactions.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/kernel/disconnected_transactions.cpp b/src/kernel/disconnected_transactions.cpp index d890702959..9c3f39135e 100644 --- a/src/kernel/disconnected_transactions.cpp +++ b/src/kernel/disconnected_transactions.cpp @@ -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(); |