Skip to content

Commit 55c79a9

Browse files
committed
ProcessOrphanTx: remove useless done variable
There is a keyword that allows us to break out of loops. Use it. There's a small change in behaviour here: if we process multiple orphans that are still orphans, then we'll only call mempool.check() once at the end, instead of after processing each tx.
1 parent 6e8dd99 commit 55c79a9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/net_processing.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,8 +2049,8 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
20492049
AssertLockHeld(cs_main);
20502050
AssertLockHeld(g_cs_orphans);
20512051
std::set<NodeId> setMisbehaving;
2052-
bool done = false;
2053-
while (!done && !orphan_work_set.empty()) {
2052+
2053+
while (!orphan_work_set.empty()) {
20542054
const uint256 orphanHash = *orphan_work_set.begin();
20552055
orphan_work_set.erase(orphan_work_set.begin());
20562056

@@ -2078,7 +2078,7 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
20782078
}
20792079
}
20802080
EraseOrphanTx(orphanHash);
2081-
done = true;
2081+
break;
20822082
} else if (orphan_state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) {
20832083
if (orphan_state.IsInvalid()) {
20842084
// Punish peer that gave us an invalid orphan tx
@@ -2124,10 +2124,10 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
21242124
}
21252125
}
21262126
EraseOrphanTx(orphanHash);
2127-
done = true;
2127+
break;
21282128
}
2129-
m_mempool.check(&::ChainstateActive().CoinsTip());
21302129
}
2130+
m_mempool.check(&::ChainstateActive().CoinsTip());
21312131
}
21322132

21332133
/**

0 commit comments

Comments
 (0)