Skip to content

Commit 6f4da19

Browse files
committed
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.
1 parent bdb33ec commit 6f4da19

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/net_processing.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4354,7 +4354,9 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
43544354
const TxValidationState& state = result.m_state;
43554355

43564356
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
4357-
ProcessValidTx(pfrom.GetId(), ptx, result.m_replaced_transactions.value());
4357+
Assume(result.m_replaced_transactions.has_value());
4358+
std::list<CTransactionRef> empty_replacement_list;
4359+
ProcessValidTx(pfrom.GetId(), ptx, result.m_replaced_transactions.value_or(empty_replacement_list));
43584360
pfrom.m_last_tx_time = GetTime<std::chrono::seconds>();
43594361
}
43604362
else if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS)

0 commit comments

Comments
 (0)