aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-01-20 14:13:14 -0500
committerJohn Newbery <john@johnnewbery.com>2017-01-20 15:05:12 -0500
commitdd5b0114cf9021e8639e48c2a33f0aaf82aeb14e (patch)
tree1e39dd97a423962aafe604cdf9532909d4ccda6b /src
parentaf01cd3a3d0647c071e94d7b0bda7128fb9aeebe (diff)
[Trivial] add comment about setting peer as HB peer.
This adds a comment to the new logic for setting HB peers based on block validation (and aligns the code below to reflect the comment). It's not obvious why we're checking mapBlocksInFlight. Add a comment to explain.
Diffstat (limited to 'src')
-rw-r--r--src/net_processing.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 36a5257635..94faaac37b 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -865,7 +865,15 @@ void PeerLogicValidation::BlockChecked(const CBlock& block, const CValidationSta
Misbehaving(it->second.first, nDoS);
}
}
- else if (state.IsValid() && !IsInitialBlockDownload() && mapBlocksInFlight.count(hash) == mapBlocksInFlight.size()) {
+ // Check that:
+ // 1. The block is valid
+ // 2. We're not in initial block download
+ // 3. This is currently the best block we're aware of. We haven't updated
+ // the tip yet so we have no way to check this directly here. Instead we
+ // just check that there are currently no other blocks in flight.
+ else if (state.IsValid() &&
+ !IsInitialBlockDownload() &&
+ mapBlocksInFlight.count(hash) == mapBlocksInFlight.size()) {
if (it != mapBlockSource.end()) {
MaybeSetPeerAsAnnouncingHeaderAndIDs(it->second.first, *connman);
}