@@ -2059,12 +2059,9 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
2059
2059
const CTransactionRef porphanTx = orphan_it->second .tx ;
2060
2060
const CTransaction& orphanTx = *porphanTx;
2061
2061
NodeId fromPeer = orphan_it->second .fromPeer ;
2062
- // Use a new TxValidationState because orphans come from different peers (and we call
2063
- // MaybePunishNodeForTx based on the source peer from the orphan map, not based on the peer
2064
- // that relayed the previous transaction).
2065
- TxValidationState orphan_state;
2062
+ TxValidationState state;
2066
2063
2067
- if (AcceptToMemoryPool (m_mempool, orphan_state , porphanTx, &removed_txn, false /* bypass_limits */ , 0 /* nAbsurdFee */ )) {
2064
+ if (AcceptToMemoryPool (m_mempool, state , porphanTx, &removed_txn, false /* bypass_limits */ , 0 /* nAbsurdFee */ )) {
2068
2065
LogPrint (BCLog::MEMPOOL, " accepted orphan tx %s\n " , orphanHash.ToString ());
2069
2066
RelayTransaction (orphanHash, porphanTx->GetWitnessHash (), m_connman);
2070
2067
for (unsigned int i = 0 ; i < orphanTx.vout .size (); i++) {
@@ -2077,19 +2074,19 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
2077
2074
}
2078
2075
EraseOrphanTx (orphanHash);
2079
2076
break ;
2080
- } else if (orphan_state .GetResult () != TxValidationResult::TX_MISSING_INPUTS) {
2081
- if (orphan_state .IsInvalid ()) {
2077
+ } else if (state .GetResult () != TxValidationResult::TX_MISSING_INPUTS) {
2078
+ if (state .IsInvalid ()) {
2082
2079
LogPrint (BCLog::MEMPOOL, " invalid orphan tx %s from peer=%d. %s\n " ,
2083
2080
orphanHash.ToString (),
2084
2081
fromPeer,
2085
- orphan_state .ToString ());
2082
+ state .ToString ());
2086
2083
// Maybe punish peer that gave us an invalid orphan tx
2087
- MaybePunishNodeForTx (fromPeer, orphan_state );
2084
+ MaybePunishNodeForTx (fromPeer, state );
2088
2085
}
2089
2086
// Has inputs but not accepted to mempool
2090
2087
// Probably non-standard or insufficient fee
2091
2088
LogPrint (BCLog::MEMPOOL, " removed orphan tx %s\n " , orphanHash.ToString ());
2092
- if (orphan_state .GetResult () != TxValidationResult::TX_WITNESS_STRIPPED) {
2089
+ if (state .GetResult () != TxValidationResult::TX_WITNESS_STRIPPED) {
2093
2090
// We can add the wtxid of this transaction to our reject filter.
2094
2091
// Do not add txids of witness transactions or witness-stripped
2095
2092
// transactions to the filter, as they can have been malleated;
@@ -2113,7 +2110,7 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
2113
2110
// processing of this transaction in the event that child
2114
2111
// transactions are later received (resulting in
2115
2112
// parent-fetching by txid via the orphan-handling logic).
2116
- if (orphan_state .GetResult () == TxValidationResult::TX_INPUTS_NOT_STANDARD && orphanTx.GetWitnessHash () != orphanTx.GetHash ()) {
2113
+ if (state .GetResult () == TxValidationResult::TX_INPUTS_NOT_STANDARD && orphanTx.GetWitnessHash () != orphanTx.GetHash ()) {
2117
2114
// We only add the txid if it differs from the wtxid, to
2118
2115
// avoid wasting entries in the rolling bloom filter.
2119
2116
recentRejects->insert (orphanTx.GetHash ());
0 commit comments