mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-28 01:36:18 +00:00
Merge pull request #1001 from nspcc-dev/net-panic-fix
network: fix panic and Inv types
This commit is contained in:
commit
52ad387866
3 changed files with 10 additions and 9 deletions
|
@ -65,6 +65,7 @@ func (c *Capability) DecodeBinary(br *io.BinReader) {
|
|||
c.Data = &Server{}
|
||||
default:
|
||||
br.Err = errors.New("unknown node capability type")
|
||||
return
|
||||
}
|
||||
c.Data.DecodeBinary(br)
|
||||
}
|
||||
|
|
|
@ -68,9 +68,9 @@ const (
|
|||
CMDGetData CommandType = 0x28
|
||||
CMDGetBlockData CommandType = 0x29
|
||||
CMDUnknown CommandType = 0x2a
|
||||
CMDTX CommandType = 0x2b
|
||||
CMDBlock CommandType = 0x2c
|
||||
CMDConsensus CommandType = 0x2d
|
||||
CMDTX = CommandType(payload.TXType)
|
||||
CMDBlock = CommandType(payload.BlockType)
|
||||
CMDConsensus = CommandType(payload.ConsensusType)
|
||||
CMDReject CommandType = 0x2f
|
||||
|
||||
// SPV protocol
|
||||
|
|
|
@ -14,11 +14,11 @@ type InventoryType uint8
|
|||
// String implements the Stringer interface.
|
||||
func (i InventoryType) String() string {
|
||||
switch i {
|
||||
case 0x01:
|
||||
case TXType:
|
||||
return "TX"
|
||||
case 0x02:
|
||||
case BlockType:
|
||||
return "block"
|
||||
case 0xe0:
|
||||
case ConsensusType:
|
||||
return "consensus"
|
||||
default:
|
||||
return "unknown inventory type"
|
||||
|
@ -32,9 +32,9 @@ func (i InventoryType) Valid() bool {
|
|||
|
||||
// List of valid InventoryTypes.
|
||||
const (
|
||||
TXType InventoryType = 0x01 // 1
|
||||
BlockType InventoryType = 0x02 // 2
|
||||
ConsensusType InventoryType = 0xe0 // 224
|
||||
TXType InventoryType = 0x2b
|
||||
BlockType InventoryType = 0x2c
|
||||
ConsensusType InventoryType = 0x2d
|
||||
)
|
||||
|
||||
// Inventory payload.
|
||||
|
|
Loading…
Reference in a new issue