mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-04 09:02:28 +00:00
network: treat unsolicited addr commands as errors
See neo-project/neo#2097.
This commit is contained in:
parent
619b6d4132
commit
2ce3c8b75f
4 changed files with 41 additions and 0 deletions
|
@ -227,6 +227,7 @@ type localPeer struct {
|
|||
t *testing.T
|
||||
messageHandler func(t *testing.T, msg *Message)
|
||||
pingSent int
|
||||
getAddrSent int
|
||||
}
|
||||
|
||||
func newLocalPeer(t *testing.T, s *Server) *localPeer {
|
||||
|
@ -323,6 +324,14 @@ func (p *localPeer) IsFullNode() bool {
|
|||
return p.isFullNode
|
||||
}
|
||||
|
||||
func (p *localPeer) AddGetAddrSent() {
|
||||
p.getAddrSent++
|
||||
}
|
||||
func (p *localPeer) CanProcessAddr() bool {
|
||||
p.getAddrSent--
|
||||
return p.getAddrSent >= 0
|
||||
}
|
||||
|
||||
func newTestServer(t *testing.T, serverConfig ServerConfig) *Server {
|
||||
s := &Server{
|
||||
ServerConfig: serverConfig,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue