mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-22 19:19:09 +00:00
network: fix "unexpected empty payload: CMDVersion"
We can have _a lot_ of these in the log, but the only reason they happen is because we're trying to interpret length before checking for reader error, CMDVersion is just 0. Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
9a3923097b
commit
121307d349
1 changed files with 3 additions and 0 deletions
|
@ -99,6 +99,9 @@ func (m *Message) Decode(br *io.BinReader) error {
|
|||
m.Flags = MessageFlag(br.ReadB())
|
||||
m.Command = CommandType(br.ReadB())
|
||||
l := br.ReadVarUint()
|
||||
if br.Err != nil {
|
||||
return br.Err
|
||||
}
|
||||
// check the length first in order not to allocate memory
|
||||
// for an empty compressed payload
|
||||
if l == 0 {
|
||||
|
|
Loading…
Reference in a new issue