From eec462b00c6d8014154c72074c75d9bf818d513d Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 29 May 2020 00:13:37 +0300 Subject: [PATCH] network: fix Inv types for Neo 3 They actually use the same types as for messages. Fixes 2020-05-29T00:06:17.593+0300 WARN peer disconnected {"addr": "168.62.167.190:20333", "reason": "handling CMDInv message: invalid inventory type", "peerCount": 3} --- pkg/network/message.go | 6 +++--- pkg/network/payload/inventory.go | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/network/message.go b/pkg/network/message.go index b38c4f5eb..6e1f55091 100644 --- a/pkg/network/message.go +++ b/pkg/network/message.go @@ -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 diff --git a/pkg/network/payload/inventory.go b/pkg/network/payload/inventory.go index d582e0486..00e211df6 100644 --- a/pkg/network/payload/inventory.go +++ b/pkg/network/payload/inventory.go @@ -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.