Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Commit

Permalink
Merge pull request #3099 from NebulousLabs/blacklist-v130
Browse files Browse the repository at this point in the history
use one const for min acceptable peer version
  • Loading branch information
lukechampine committed Jun 12, 2018
2 parents bd8987c + 97c88b1 commit 94ea84e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 0 additions & 6 deletions modules/gateway/consts.go
Expand Up @@ -25,12 +25,6 @@ const (
// connect to itself, this number can be reduced.
maxLocalOutboundPeers = 3

// minAcceptableVersion is the version below which the gateway will refuse to
// connect to peers and reject connection attempts.
//
// Reject peers < v1.3.0 due to hardfork.
minAcceptableVersion = "1.3.0"

// saveFrequency defines how often the gateway saves its persistence.
saveFrequency = time.Minute * 2

Expand Down
2 changes: 1 addition & 1 deletion modules/gateway/peers.go
Expand Up @@ -291,7 +291,7 @@ func acceptableVersion(version string) error {
if !build.IsVersion(version) {
return invalidVersionError(version)
}
if build.VersionCmp(version, minAcceptableVersion) < 0 {
if build.VersionCmp(version, minimumAcceptablePeerVersion) < 0 {
return insufficientVersionError(version)
}
return nil
Expand Down
6 changes: 4 additions & 2 deletions modules/gateway/peers_test.go
Expand Up @@ -414,6 +414,7 @@ func TestUnitAcceptableVersion(t *testing.T) {
"0.3.3",
"0.3.9.9.9.9.9.9.9.9.9.9",
"0.3.9999999999",
"1.3.0",
}
for _, v := range insufficientVersions {
err := acceptableVersion(v)
Expand All @@ -422,8 +423,9 @@ func TestUnitAcceptableVersion(t *testing.T) {
}
}
validVersions := []string{
minAcceptableVersion,
minimumAcceptablePeerVersion,
"1.4.0",
"1.3.1",
"1.6.0",
"1.6.1",
"1.9",
Expand Down Expand Up @@ -746,7 +748,7 @@ func TestAcceptConnRejectsVersions(t *testing.T) {
// Test that acceptConn succeeds when the remote peer's version is
// minAcceptableVersion
{
remoteVersion: minAcceptableVersion,
remoteVersion: minimumAcceptablePeerVersion,
versionResponseWant: build.Version,
msg: "acceptConn should accept a remote peer whose version is 0.4.0",
},
Expand Down

0 comments on commit 94ea84e

Please sign in to comment.