aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2024-03-13 11:25:24 +0000
committerglozow <gloriajzhao@gmail.com>2024-04-16 10:09:45 +0100
commit6f4da19cc3b1b7cd23cb4be95a6bb9acb79eb3bf (patch)
treeee6049fd4b0cd42c274baa231cca12f5be81f0e4 /src/net_processing.cpp
parentbdb33ec51986570ea17406c83bad2c955ae23186 (diff)
guard against MempoolAcceptResult::m_replaced_transactions
It should never be a nullopt when the transaction result is valid - Assume() this is the case. However, as a belt-and-suspenders just in case it is nullopt, use an empty list.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 39ffff97d2..07ac1cfec7 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -4354,7 +4354,9 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
const TxValidationState& state = result.m_state;
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
- ProcessValidTx(pfrom.GetId(), ptx, result.m_replaced_transactions.value());
+ Assume(result.m_replaced_transactions.has_value());
+ std::list<CTransactionRef> empty_replacement_list;
+ ProcessValidTx(pfrom.GetId(), ptx, result.m_replaced_transactions.value_or(empty_replacement_list));
pfrom.m_last_tx_time = GetTime<std::chrono::seconds>();
}
else if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS)