aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2020-06-25 15:37:51 -0400
committerJohn Newbery <john@johnnewbery.com>2020-09-07 19:57:32 +0100
commit55c79a9cefb6c83cdebbf6c538c471607695b457 (patch)
treed6a042f285f70e59b2dd11be0e553d298431fd45 /src/net_processing.cpp
parent6e8dd99ef1c147898bd06fee7014afdff6618f18 (diff)
downloadbitcoin-55c79a9cefb6c83cdebbf6c538c471607695b457.tar.xz
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.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index c932062a28..45cb29065e 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -2049,8 +2049,8 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
AssertLockHeld(cs_main);
AssertLockHeld(g_cs_orphans);
std::set<NodeId> setMisbehaving;
- bool done = false;
- while (!done && !orphan_work_set.empty()) {
+
+ while (!orphan_work_set.empty()) {
const uint256 orphanHash = *orphan_work_set.begin();
orphan_work_set.erase(orphan_work_set.begin());
@@ -2078,7 +2078,7 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
}
}
EraseOrphanTx(orphanHash);
- done = true;
+ break;
} else if (orphan_state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) {
if (orphan_state.IsInvalid()) {
// Punish peer that gave us an invalid orphan tx
@@ -2124,10 +2124,10 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
}
}
EraseOrphanTx(orphanHash);
- done = true;
+ break;
}
- m_mempool.check(&::ChainstateActive().CoinsTip());
}
+ m_mempool.check(&::ChainstateActive().CoinsTip());
}
/**