network: treat unsolicited addr commands as errors

See neo-project/neo#2097.
This commit is contained in:
Roman Khimov 2020-11-25 13:34:38 +03:00
parent 619b6d4132
commit 2ce3c8b75f
4 changed files with 41 additions and 0 deletions

View file

@ -72,4 +72,13 @@ type Peer interface {
// HandlePong checks pong contents against Peer's state and updates it.
HandlePong(pong *payload.Ping) error
// AddGetAddrSent is to inform local peer context that a getaddr command
// is sent. The decision to send getaddr is server-wide, but it needs to be
// accounted for in peer's context, thus this method.
AddGetAddrSent()
// CanProcessAddr checks whether an addr command is expected to come from
// this peer and can be processed.
CanProcessAddr() bool
}