Skip to content

Commit

Permalink
[Trivial] add comment about setting peer as HB peer.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jnewbery committed Jan 20, 2017
1 parent af01cd3 commit dd5b011
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/net_processing.cpp
Expand Up @@ -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);
}
Expand Down

0 comments on commit dd5b011

Please sign in to comment.