Unverified Commit 94ea84e3 authored by Luke Champine's avatar Luke Champine Committed by GitHub

Merge pull request #3099 from NebulousLabs/blacklist-v130

use one const for min acceptable peer version
parents bd8987c9 97c88b1e
......@@ -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
......
......@@ -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
......
......@@ -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)
......@@ -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",
......@@ -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",
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment