File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ go 1.25.0
55require (
66 github.com/decred/vspd/types/v3 v3.0.0
77 github.com/gorilla/handlers v1.5.2
8+ golang.org/x/mod v0.37.0
89)
910
1011require github.com/felixge/httpsnoop v1.1.0 // indirect
Original file line number Diff line number Diff line change @@ -4,3 +4,5 @@ github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeO
44github.com/felixge/httpsnoop v1.1.0 /go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE =
55github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE =
66github.com/gorilla/handlers v1.5.2 /go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w =
7+ golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ =
8+ golang.org/x/mod v0.37.0 /go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0 =
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import (
1515 "time"
1616
1717 "github.com/decred/vspd/types/v3"
18+ "golang.org/x/mod/semver"
1819)
1920
2021// Vsp contains information about a single Voting Service Provider. Includes
@@ -209,6 +210,11 @@ func (s *Service) vspStats(url string, vsp Vsp) error {
209210 return fmt .Errorf ("%v: unmarshal failed: %w" , infoURL , err )
210211 }
211212
213+ // semver library expects the "v" prefix but vspd does not return it.
214+ if ! semver .IsValid ("v" + info .VspdVersion ) {
215+ return fmt .Errorf ("%v: version not valid (%q)" , infoURL , info .VspdVersion )
216+ }
217+
212218 vsp .APIVersions = info .APIVersions
213219 vsp .FeePercentage = info .FeePercentage
214220 vsp .Closed = info .VspClosed
You can’t perform that action at this time.
0 commit comments