diff options
author | glozow <gloriajzhao@gmail.com> | 2024-04-29 17:53:59 +0100 |
---|---|---|
committer | glozow <gloriajzhao@gmail.com> | 2024-05-01 13:34:37 +0100 |
commit | 8496f69e1c2d1961db2604829cb6a289eb8dd3d6 (patch) | |
tree | 81d70e34c31c352672bc5a2a665a6ccecf90f46e /src/net_processing.cpp | |
parent | 842f7fdf786fcbbdf3df40522945813404f8a397 (diff) |
[refactor] make MempoolAcceptResult::m_replaced_transactions non-optional
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r-- | src/net_processing.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index bdbf077ab5..6aefd6aa79 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3281,9 +3281,7 @@ void PeerManagerImpl::ProcessPackageResult(const Package& package, const Package switch (tx_result.m_result_type) { case MempoolAcceptResult::ResultType::VALID: { - Assume(tx_result.m_replaced_transactions.has_value()); - std::list<CTransactionRef> empty_replacement_list; - ProcessValidTx(nodeid, tx, tx_result.m_replaced_transactions.value_or(empty_replacement_list)); + ProcessValidTx(nodeid, tx, tx_result.m_replaced_transactions); break; } case MempoolAcceptResult::ResultType::INVALID: @@ -3378,9 +3376,7 @@ bool PeerManagerImpl::ProcessOrphanTx(Peer& peer) if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) { LogPrint(BCLog::TXPACKAGES, " accepted orphan tx %s (wtxid=%s)\n", orphanHash.ToString(), orphan_wtxid.ToString()); - Assume(result.m_replaced_transactions.has_value()); - std::list<CTransactionRef> empty_replacement_list; - ProcessValidTx(peer.m_id, porphanTx, result.m_replaced_transactions.value_or(empty_replacement_list)); + ProcessValidTx(peer.m_id, porphanTx, result.m_replaced_transactions); return true; } else if (state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) { LogPrint(BCLog::TXPACKAGES, " invalid orphan tx %s (wtxid=%s) from peer=%d. %s\n", @@ -4578,9 +4574,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, const TxValidationState& state = result.m_state; if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) { - 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)); + ProcessValidTx(pfrom.GetId(), ptx, result.m_replaced_transactions); pfrom.m_last_tx_time = GetTime<std::chrono::seconds>(); } else if (state.GetResult() == TxValidationResult::TX_MISSING_INPUTS) |