aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2020-06-25 15:47:54 -0400
committerJohn Newbery <john@johnnewbery.com>2020-09-07 20:08:43 +0100
commite07c5d94231cefb748f9534ab8ff0b3e2b04c4d8 (patch)
treebcb8dbe98cc7a317fc1e54a216bafcec376fa935 /src
parent4763b51bca86fb9e49175619a47cdbef34feaf99 (diff)
ProcessOrphanTx: Remove outdated commented
Also rename orphan_state to state. Both the comment and the variable name are leftover from when this logic was part of ProcessMessage().
Diffstat (limited to 'src')
-rw-r--r--src/net_processing.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 40783e210c..e28775d84c 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -2059,12 +2059,9 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
const CTransactionRef porphanTx = orphan_it->second.tx;
const CTransaction& orphanTx = *porphanTx;
NodeId fromPeer = orphan_it->second.fromPeer;
- // Use a new TxValidationState because orphans come from different peers (and we call
- // MaybePunishNodeForTx based on the source peer from the orphan map, not based on the peer
- // that relayed the previous transaction).
- TxValidationState orphan_state;
+ TxValidationState state;
- if (AcceptToMemoryPool(m_mempool, orphan_state, porphanTx, &removed_txn, false /* bypass_limits */, 0 /* nAbsurdFee */)) {
+ if (AcceptToMemoryPool(m_mempool, state, porphanTx, &removed_txn, false /* bypass_limits */, 0 /* nAbsurdFee */)) {
LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", orphanHash.ToString());
RelayTransaction(orphanHash, porphanTx->GetWitnessHash(), m_connman);
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<
}
EraseOrphanTx(orphanHash);
break;
- } else if (orphan_state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) {
- if (orphan_state.IsInvalid()) {
+ } else if (state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) {
+ if (state.IsInvalid()) {
LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s from peer=%d. %s\n",
orphanHash.ToString(),
fromPeer,
- orphan_state.ToString());
+ state.ToString());
// Maybe punish peer that gave us an invalid orphan tx
- MaybePunishNodeForTx(fromPeer, orphan_state);
+ MaybePunishNodeForTx(fromPeer, state);
}
// Has inputs but not accepted to mempool
// Probably non-standard or insufficient fee
LogPrint(BCLog::MEMPOOL, " removed orphan tx %s\n", orphanHash.ToString());
- if (orphan_state.GetResult() != TxValidationResult::TX_WITNESS_STRIPPED) {
+ if (state.GetResult() != TxValidationResult::TX_WITNESS_STRIPPED) {
// We can add the wtxid of this transaction to our reject filter.
// Do not add txids of witness transactions or witness-stripped
// 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<
// processing of this transaction in the event that child
// transactions are later received (resulting in
// parent-fetching by txid via the orphan-handling logic).
- if (orphan_state.GetResult() == TxValidationResult::TX_INPUTS_NOT_STANDARD && orphanTx.GetWitnessHash() != orphanTx.GetHash()) {
+ if (state.GetResult() == TxValidationResult::TX_INPUTS_NOT_STANDARD && orphanTx.GetWitnessHash() != orphanTx.GetHash()) {
// We only add the txid if it differs from the wtxid, to
// avoid wasting entries in the rolling bloom filter.
recentRejects->insert(orphanTx.GetHash());