diff --git a/catchup/catchpointService.go b/catchup/catchpointService.go index 3c11d0db73..3954c1cd6c 100644 --- a/catchup/catchpointService.go +++ b/catchup/catchpointService.go @@ -824,6 +824,8 @@ func (cs *CatchpointCatchupService) checkLedgerDownload() error { if err == nil { return nil } + // a non-nil error means that the catchpoint is not available, so we should rank it accordingly + cs.blocksDownloadPeerSelector.rankPeer(psp, peerRankNoCatchpointForRound) } return fmt.Errorf("checkLedgerDownload(): catchpoint '%s' unavailable from peers: %s", cs.stats.CatchpointLabel, err) } diff --git a/catchup/peerSelector.go b/catchup/peerSelector.go index 05556bb24b..a8eefb0958 100644 --- a/catchup/peerSelector.go +++ b/catchup/peerSelector.go @@ -55,6 +55,10 @@ const ( // This indicates a peer is either behind or a block has not happened yet, or does not have a block that is old enough. peerRankNoBlockForRound = 2000 + // peerRankNoCatchpointForRound is used for responses failed because of no catchpoint for round + // This indicates a peer is either behind or a catchpoint has not been produced, or this node did not retain this catchpoint (aged out). + peerRankNoCatchpointForRound = 2000 + // peerRankDownloadFailed is used for responses which could be temporary, such as missing files, or such that we don't // have clear resolution peerRankDownloadFailed = 10000