mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-09 10:43:19 -05:00
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.
This commit is contained in:
parent
bdb33ec519
commit
6f4da19cc3
1 changed files with 3 additions and 1 deletions
|
@ -4354,7 +4354,9 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||||
const TxValidationState& state = result.m_state;
|
const TxValidationState& state = result.m_state;
|
||||||
|
|
||||||
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
|
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>();
|
pfrom.m_last_tx_time = GetTime<std::chrono::seconds>();
|
||||||
}
|
}
|
||||||
else if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS)
|
else if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS)
|
||||||
|
|
Loading…
Add table
Reference in a new issue