Skip to content

Commit

Permalink
Network: Penalize peer/class rankings when peer does not have catchpo…
Browse files Browse the repository at this point in the history
…int (algorand#5959)
  • Loading branch information
gmalouf authored Mar 15, 2024
1 parent dd22cff commit 98ac36a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions catchup/catchpointService.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
4 changes: 4 additions & 0 deletions catchup/peerSelector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 98ac36a

Please sign in to comment.