Skip to content

Commit

Permalink
Ignore sector roots range prune alert on old hosts (#1343)
Browse files Browse the repository at this point in the history
The sector roots RPC used to return all sector roots, this was fixed in
SiaFoundation/hostd@e6dfc96
and released in
https://github.com/SiaFoundation/hostd/releases/tag/v1.0.2-beta.4 . We
should ignore the error for old hosts.
  • Loading branch information
peterjan authored Jun 27, 2024
1 parent 5c645c1 commit bf2d616
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions autopilot/contract_pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var (
errInvalidHandshake = errors.New("couldn't read host's handshake")
errInvalidHandshakeSignature = errors.New("host's handshake signature was invalid")
errInvalidMerkleProof = errors.New("host supplied invalid Merkle proof")
errInvalidSectorRootsRange = errors.New("number of roots does not match range")
)

const (
Expand Down Expand Up @@ -237,9 +238,10 @@ func humanReadableSize(b int) string {
}

func shouldSendPruneAlert(err error, version, release string) bool {
merkleRootIssue := utils.IsErr(err, errInvalidMerkleProof) &&
(build.VersionCmp(version, "1.6.0") < 0 || version == "1.6.0" && release == "")
return err != nil && !(merkleRootIssue ||
oldHost := (build.VersionCmp(version, "1.6.0") < 0 || version == "1.6.0" && release == "")
sectorRootsIssue := utils.IsErr(err, errInvalidSectorRootsRange) && oldHost
merkleRootIssue := utils.IsErr(err, errInvalidMerkleProof) && oldHost
return err != nil && !(sectorRootsIssue || merkleRootIssue ||
utils.IsErr(err, utils.ErrConnectionRefused) ||
utils.IsErr(err, utils.ErrConnectionTimedOut) ||
utils.IsErr(err, utils.ErrConnectionResetByPeer) ||
Expand Down

0 comments on commit bf2d616

Please sign in to comment.