Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network: Penalize peer/class rankings when peer does not have catchpoint #5959

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@
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)

Check warning on line 828 in catchup/catchpointService.go

View check run for this annotation

Codecov / codecov/patch

catchup/catchpointService.go#L828

Added line #L828 was not covered by tests
jannotti marked this conversation as resolved.
Show resolved Hide resolved
}
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