network: fix SIGSEGV on unknown message acceptance
For example, at the moment our node can't handle `consensus` message, so when it received it before the patch it just crashed because of uninitialized `p`.
This commit is contained in:
parent
4b4bac675b
commit
5a0f08f2c0
1 changed files with 3 additions and 0 deletions
|
@ -3,6 +3,7 @@ package network
|
|||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/CityOfZion/neo-go/config"
|
||||
"github.com/CityOfZion/neo-go/pkg/core"
|
||||
|
@ -193,6 +194,8 @@ func (m *Message) decodePayload(br *io.BinReader) error {
|
|||
p = &transaction.Transaction{}
|
||||
case CMDMerkleBlock:
|
||||
p = &payload.MerkleBlock{}
|
||||
default:
|
||||
return fmt.Errorf("can't decode command %s", cmdByteArrayToString(m.Command))
|
||||
}
|
||||
p.DecodeBinary(r)
|
||||
if r.Err != nil {
|
||||
|
|
Loading…
Reference in a new issue