Browse Source

NodeInfo version check: delete redundant code

pull/1985/head
needkane 6 years ago
committed by Anton Kaliaev
parent
commit
449846ccb2
1 changed files with 4 additions and 8 deletions
  1. +4
    -8
      p2p/node_info.go

+ 4
- 8
p2p/node_info.go 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)
oMajor, oMinor, _, oErr := splitVersion(other.Version)
iMajor, _, _, iErr := splitVersion(info.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)


Loading…
Cancel
Save