Skip to content

Commit

Permalink
Merge pull request #213 from kcalvinalvin/2024-11-07-dont-fetch-block…
Browse files Browse the repository at this point in the history
…s-from-equal-peers

netsync: don't ask for blocks from peers on the same block height
  • Loading branch information
kcalvinalvin authored Nov 11, 2024
2 parents 6368725 + 328b87a commit 81c4487
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions netsync/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,11 @@ func (sm *SyncManager) startSync() {
higherPeers = append(higherPeers, peer)
}

if sm.chain.IsCurrent() && len(higherPeers) == 0 {
log.Infof("Caught up to block %s(%d)", best.Hash.String(), best.Height)
return
}

// Pick randomly from the set of peers greater than our block height,
// falling back to a random peer of the same height if none are greater.
//
Expand Down

0 comments on commit 81c4487

Please sign in to comment.