Skip to content

Commit e07c5d9

Browse files
committed
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().
1 parent 4763b51 commit e07c5d9

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/net_processing.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,12 +2059,9 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
20592059
const CTransactionRef porphanTx = orphan_it->second.tx;
20602060
const CTransaction& orphanTx = *porphanTx;
20612061
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;
20662063

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 */)) {
20682065
LogPrint(BCLog::MEMPOOL, " accepted orphan tx %s\n", orphanHash.ToString());
20692066
RelayTransaction(orphanHash, porphanTx->GetWitnessHash(), m_connman);
20702067
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<
20772074
}
20782075
EraseOrphanTx(orphanHash);
20792076
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()) {
20822079
LogPrint(BCLog::MEMPOOL, " invalid orphan tx %s from peer=%d. %s\n",
20832080
orphanHash.ToString(),
20842081
fromPeer,
2085-
orphan_state.ToString());
2082+
state.ToString());
20862083
// Maybe punish peer that gave us an invalid orphan tx
2087-
MaybePunishNodeForTx(fromPeer, orphan_state);
2084+
MaybePunishNodeForTx(fromPeer, state);
20882085
}
20892086
// Has inputs but not accepted to mempool
20902087
// Probably non-standard or insufficient fee
20912088
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) {
20932090
// We can add the wtxid of this transaction to our reject filter.
20942091
// Do not add txids of witness transactions or witness-stripped
20952092
// 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<
21132110
// processing of this transaction in the event that child
21142111
// transactions are later received (resulting in
21152112
// 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()) {
21172114
// We only add the txid if it differs from the wtxid, to
21182115
// avoid wasting entries in the rolling bloom filter.
21192116
recentRejects->insert(orphanTx.GetHash());

0 commit comments

Comments
 (0)