diff --git a/pkg/network/server.go b/pkg/network/server.go index ccf876587..fb3732505 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -23,7 +23,6 @@ const ( ) var ( - errPortMismatch = errors.New("port mismatch") errIdenticalID = errors.New("identical node id") errInvalidHandshake = errors.New("invalid handshake") errInvalidNetwork = errors.New("invalid network") @@ -248,7 +247,7 @@ func (s *Server) handleVersionCmd(p Peer, version *payload.Version) error { return errIdenticalID } if p.NetAddr().Port != int(version.Port) { - return errPortMismatch + return fmt.Errorf("port mismatch: connected to %d and peer sends %d", p.NetAddr().Port, version.Port) } return p.SendVersionAck(NewMessage(s.Net, CMDVerack, nil)) } diff --git a/pkg/network/server_test.go b/pkg/network/server_test.go index 0d4e1238b..7d96b7989 100644 --- a/pkg/network/server_test.go +++ b/pkg/network/server_test.go @@ -71,7 +71,7 @@ func TestServerNotSendsVerack(t *testing.T) { version := payload.NewVersion(1337, 2000, "/NEO-GO/", 0, true) err := s.handleVersionCmd(p, version) assert.NotNil(t, err) - assert.Equal(t, errPortMismatch, err) + assert.Contains(t, err.Error(), "port mismatch") // identical id's version = payload.NewVersion(1, 3000, "/NEO-GO/", 0, true)