types.go
func (info *NodeInfo) CompatibleWith(other *NodeInfo) error {
	iMajor, iMinor, _, iErr := splitVersion(info.Version)
	oMajor, oMinor, _, oErr := splitVersion(other.Version)

	// if our own version number is not formatted right, we messed up
	if iErr != nil {
		return iErr
	}

	// version number must be formatted correctly ("x.x.x")
	if oErr != nil {
		return oErr
	}

	// major version must match
	if iMajor != oMajor {
		return fmt.Errorf("Peer is on a different major version. Got %v, expected %v", oMajor, iMajor)
	}

	// minor version must match
	if iMinor != oMinor {
		return fmt.Errorf("Peer is on a different minor version. Got %v, expected %v", oMinor, iMinor)
	}

	// nodes must be on the same network
	if info.Network != other.Network {
		return fmt.Errorf("Peer is on a different network. Got %v, expected %v", other.Network, info.Network)
	}

	return nil
}
func (info *NodeInfo) CompatibleWith(other *NodeInfo) error {
	iMajor, iMinor, _, iErr := splitVersion(info.Version)
	oMajor, oMinor, _, oErr := splitVersion(other.Version)

	// if our own version number is not formatted right, we messed up
	if iErr != nil {
		return iErr
	}

	// version number must be formatted correctly ("x.x.x")
	if oErr != nil {
		return oErr
	}

	// major version must match
	if iMajor != oMajor {
		return fmt.Errorf("Peer is on a different major version. Got %v, expected %v", oMajor, iMajor)
	}

	// minor version must match
	if iMinor != oMinor {
		return fmt.Errorf("Peer is on a different minor version. Got %v, expected %v", oMinor, iMinor)
	}

	// nodes must be on the same network
	if info.Network != other.Network {
		return fmt.Errorf("Peer is on a different network. Got %v, expected %v", other.Network, info.Network)
	}

	return nil
}
func ( info * NodeInfo ) CompatibleWith ( other * NodeInfo ) error { iMajor , iMinor , _ , iErr := splitVersion ( info . Version ) oMajor , oMinor , _ , oErr := splitVersion ( other . Version ) // if our own version number is not formatted right, we messed up if iErr != nil { return iErr } // version number must be formatted correctly ("x.x.x") if oErr != nil { return oErr } // major version must match if iMajor != oMajor { return fmt . Errorf ( " " , oMajor , iMajor ) } // minor version must match if iMinor != oMinor { return fmt . Errorf ( " " , oMinor , iMinor ) } // nodes must be on the same network if info . Network != other . Network { return fmt . Errorf ( " " , other . Network , info . Network ) } return nil }
// CONTRACT: two nodes are compatible if the major/minor versions match and network match
CONTRACT : two nodes are compatible if the major / minor versions match and network match