forked from TrueCloudLab/neoneo-go
network: remove port check from handleVersionCmd()
It's bogus and no other node implementation has anything like that. It fires up for no good reason in the case when some other node connects to us and it obviously doesn't use its listening port for it.
This commit is contained in:
parent
b9fc34e8c3
commit
56459c6c63
2 changed files with 2 additions and 11 deletions
|
@ -252,9 +252,6 @@ func (s *Server) handleVersionCmd(p Peer, version *payload.Version) error {
|
|||
if s.id == version.Nonce {
|
||||
return errIdenticalID
|
||||
}
|
||||
if p.NetAddr().Port != int(version.Port) {
|
||||
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))
|
||||
}
|
||||
|
||||
|
|
|
@ -67,15 +67,9 @@ func TestServerNotSendsVerack(t *testing.T) {
|
|||
p.netaddr = *na
|
||||
s.register <- p
|
||||
|
||||
// Port should mismatch
|
||||
version := payload.NewVersion(1337, 2000, "/NEO-GO/", 0, true)
|
||||
err := s.handleVersionCmd(p, version)
|
||||
assert.NotNil(t, err)
|
||||
assert.Contains(t, err.Error(), "port mismatch")
|
||||
|
||||
// identical id's
|
||||
version = payload.NewVersion(1, 3000, "/NEO-GO/", 0, true)
|
||||
err = s.handleVersionCmd(p, version)
|
||||
version := payload.NewVersion(1, 3000, "/NEO-GO/", 0, true)
|
||||
err := s.handleVersionCmd(p, version)
|
||||
assert.NotNil(t, err)
|
||||
assert.Equal(t, errIdenticalID, err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue