diff options
author | Andrew Chow <github@achow101.com> | 2023-11-28 14:38:31 -0500 |
---|---|---|
committer | Andrew Chow <github@achow101.com> | 2023-11-28 14:45:23 -0500 |
commit | 535424a10b4462a813b9797f3c607b97a0ca9b19 (patch) | |
tree | fe59495fa0464554aa742614d0109dd0eb2a149b /src/txmempool.cpp | |
parent | 30a055782908702c012bdd5f6a6d41458bf22dfa (diff) | |
parent | 705e3f1de00bf30d728addd52a790a139d948e32 (diff) |
Merge bitcoin/bitcoin#28903: refactor: Make CTxMemPoolEntry only explicitly copyable
705e3f1de00bf30d728addd52a790a139d948e32 refactor: Make CTxMemPoolEntry only explicitly copyable (TheCharlatan)
Pull request description:
This has the goal of prohibiting users from accidentally creating runtime failures, e.g. by interacting with iterator_to with a copied entry. This was brought up here: https://github.com/bitcoin/bitcoin/pull/28886#issuecomment-1814794954.
CTxMemPoolEntry is already implicitly not move-constructable. So be explicit about this and use a std::list to collect the values in the policy_estimator fuzz test instead of a std::vector.
ACKs for top commit:
maflcko:
ACK 705e3f1de00bf30d728addd52a790a139d948e32 🌯
achow101:
ACK 705e3f1de00bf30d728addd52a790a139d948e32
ajtowns:
ACK 705e3f1de00bf30d728addd52a790a139d948e32
ismaelsadeeq:
ACK 705e3f1de00bf30d728addd52a790a139d948e32
Tree-SHA512: 62056905c679c919d00f9ae065ed66ac986e7e7062015aea542843d8deecda57104d7a68d002f7b20afa3164f8e9215d2d2d002c167224129540e3b1bd0712cc
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r-- | src/txmempool.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp index b6be395d74..c53431cf8a 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -438,7 +438,7 @@ void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAnces // Add to memory pool without checking anything. // Used by AcceptToMemoryPool(), which DOES do // all the appropriate checks. - indexed_transaction_set::iterator newit = mapTx.insert(entry).first; + indexed_transaction_set::iterator newit = mapTx.emplace(CTxMemPoolEntry::ExplicitCopy, entry).first; // Update transaction for any feeDelta created by PrioritiseTransaction CAmount delta{0}; |