aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2023-08-10 11:47:56 +0100
committerglozow <gloriajzhao@gmail.com>2023-09-13 16:14:17 +0100
commit8ad7ad33929ee846a55a43c55732be0cb8973060 (patch)
tree0bb6571cd53ba32ce532de76d40eeaa2a9f14989 /src
parent03b87c11ca0705e1d6147b90da33ce555f9f41c8 (diff)
downloadbitcoin-8ad7ad33929ee846a55a43c55732be0cb8973060.tar.xz
[validation] make PackageMempoolAcceptResult members mutable
After the PackageMempoolAcceptResult is returned from AcceptMultipleTransactions, leave room for results to change due to LimitMempool() eviction.
Diffstat (limited to 'src')
-rw-r--r--src/validation.cpp8
-rw-r--r--src/validation.h8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 639b263463..e835728a53 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -655,7 +655,7 @@ private:
// The package may end up partially-submitted after size limiting; returns true if all
// transactions are successfully added to the mempool, false otherwise.
bool SubmitPackage(const ATMPArgs& args, std::vector<Workspace>& workspaces, PackageValidationState& package_state,
- std::map<const uint256, const MempoolAcceptResult>& results)
+ std::map<uint256, MempoolAcceptResult>& results)
EXCLUSIVE_LOCKS_REQUIRED(cs_main, m_pool.cs);
// Compare a package's feerate against minimum allowed.
@@ -1132,7 +1132,7 @@ bool MemPoolAccept::Finalize(const ATMPArgs& args, Workspace& ws)
bool MemPoolAccept::SubmitPackage(const ATMPArgs& args, std::vector<Workspace>& workspaces,
PackageValidationState& package_state,
- std::map<const uint256, const MempoolAcceptResult>& results)
+ std::map<uint256, MempoolAcceptResult>& results)
{
AssertLockHeld(cs_main);
AssertLockHeld(m_pool.cs);
@@ -1262,7 +1262,7 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptMultipleTransactions(const std::
workspaces.reserve(txns.size());
std::transform(txns.cbegin(), txns.cend(), std::back_inserter(workspaces),
[](const auto& tx) { return Workspace(tx); });
- std::map<const uint256, const MempoolAcceptResult> results;
+ std::map<uint256, MempoolAcceptResult> results;
LOCK(m_pool.cs);
@@ -1444,7 +1444,7 @@ PackageMempoolAcceptResult MemPoolAccept::AcceptPackage(const Package& package,
LOCK(m_pool.cs);
// Stores final results that won't change
- std::map<const uint256, const MempoolAcceptResult> results_final;
+ std::map<uint256, MempoolAcceptResult> results_final;
// Results from individual validation. "Nonfinal" because if a transaction fails by itself but
// succeeds later (i.e. when evaluated with a fee-bumping child), the result changes (though not
// reflected in this map). If a transaction fails more than once, we want to return the first
diff --git a/src/validation.h b/src/validation.h
index d7ad86a5e8..aacc693300 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -211,21 +211,21 @@ private:
*/
struct PackageMempoolAcceptResult
{
- const PackageValidationState m_state;
+ PackageValidationState m_state;
/**
* Map from wtxid to finished MempoolAcceptResults. The client is responsible
* for keeping track of the transaction objects themselves. If a result is not
* present, it means validation was unfinished for that transaction. If there
* was a package-wide error (see result in m_state), m_tx_results will be empty.
*/
- std::map<const uint256, const MempoolAcceptResult> m_tx_results;
+ std::map<uint256, MempoolAcceptResult> m_tx_results;
explicit PackageMempoolAcceptResult(PackageValidationState state,
- std::map<const uint256, const MempoolAcceptResult>&& results)
+ std::map<uint256, MempoolAcceptResult>&& results)
: m_state{state}, m_tx_results(std::move(results)) {}
explicit PackageMempoolAcceptResult(PackageValidationState state, CFeeRate feerate,
- std::map<const uint256, const MempoolAcceptResult>&& results)
+ std::map<uint256, MempoolAcceptResult>&& results)
: m_state{state}, m_tx_results(std::move(results)) {}
/** Constructor to create a PackageMempoolAcceptResult from a single MempoolAcceptResult */