diff options
author | TheCharlatan <seb.kung@gmail.com> | 2023-11-17 20:28:14 +0100 |
---|---|---|
committer | TheCharlatan <seb.kung@gmail.com> | 2023-11-17 23:02:02 +0100 |
commit | 705e3f1de00bf30d728addd52a790a139d948e32 (patch) | |
tree | 3a48a2a69d555b000d6b085c210c35074581003b /src/txmempool.cpp | |
parent | 22025d06e53f9bfccf88c600815f1cc496595d5d (diff) |
refactor: Make CTxMemPoolEntry only explicitly copyable
This has the goal of prohibiting users from accidentally creating
runtime failures, e.g. by interacting with iterator_to with a copied
entry.
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.
Co-authored-by: Anthony Towns <aj@erisian.com.au>
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 e057d7ece1..f6b8051451 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}; |