NodeInfo version check: delete redundant code

This commit is contained in:
needkane 2018-07-18 17:12:52 +08:00 committed by Anton Kaliaev
parent 3353bb99ae
commit 449846ccb2

View File

@ -2,8 +2,9 @@ package p2p
import ( import (
"fmt" "fmt"
cmn "github.com/tendermint/tendermint/libs/common"
"strings" "strings"
cmn "github.com/tendermint/tendermint/libs/common"
) )
const ( const (
@ -81,8 +82,8 @@ func (info NodeInfo) Validate() error {
// CONTRACT: two nodes are compatible if the major version matches and network match // CONTRACT: two nodes are compatible if the major version matches and network match
// and they have at least one channel in common. // and they have at least one channel in common.
func (info NodeInfo) CompatibleWith(other NodeInfo) error { func (info NodeInfo) CompatibleWith(other NodeInfo) error {
iMajor, iMinor, _, iErr := splitVersion(info.Version) iMajor, _, _, iErr := splitVersion(info.Version)
oMajor, oMinor, _, oErr := splitVersion(other.Version) oMajor, _, _, oErr := splitVersion(other.Version)
// if our own version number is not formatted right, we messed up // if our own version number is not formatted right, we messed up
if iErr != nil { if iErr != nil {
@ -99,11 +100,6 @@ func (info NodeInfo) CompatibleWith(other NodeInfo) error {
return fmt.Errorf("Peer is on a different major version. Got %v, expected %v", oMajor, iMajor) return fmt.Errorf("Peer is on a different major version. Got %v, expected %v", oMajor, iMajor)
} }
// minor version can differ
if iMinor != oMinor {
// ok
}
// nodes must be on the same network // nodes must be on the same network
if info.Network != other.Network { if info.Network != other.Network {
return fmt.Errorf("Peer is on a different network. Got %v, expected %v", other.Network, info.Network) return fmt.Errorf("Peer is on a different network. Got %v, expected %v", other.Network, info.Network)