aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-02-07 13:03:21 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-02-07 13:03:57 +0100
commit729de15b6365face6ae9e12a03624da33a6302f0 (patch)
tree7c93bffbb4ce457da7b6b957f4fbd935613f4462
parent02464da5e4aa8c19d4fff3859dcdee822e2af78c (diff)
parentdd5b0114cf9021e8639e48c2a33f0aaf82aeb14e (diff)
Merge #9604: [Trivial] add comment about setting peer as HB peer.
dd5b011 [Trivial] add comment about setting peer as HB peer. (John Newbery)
-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 3a89c7ac42..bb14e69d83 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -863,7 +863,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);
}