From 0f265a6a049a370fc013dbd67d063158041a842a Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 27 Aug 2019 20:08:48 +0300 Subject: [PATCH] _pkg.dev: drop wire/command Transferring some missing commands to pkg/network. --- _pkg.dev/wire/command/command.go | 29 ----------------------------- pkg/network/message.go | 9 +++++++++ 2 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 _pkg.dev/wire/command/command.go diff --git a/_pkg.dev/wire/command/command.go b/_pkg.dev/wire/command/command.go deleted file mode 100644 index d89dcd335..000000000 --- a/_pkg.dev/wire/command/command.go +++ /dev/null @@ -1,29 +0,0 @@ -package command - -// Size of command field in bytes -const ( - Size = 12 -) - -// Type represents the type of a message command. -type Type string - -// Valid protocol commands used to send between nodes. -const ( - Version Type = "version" - Mempool Type = "mempool" - Ping Type = "ping" - Pong Type = "pong" - Verack Type = "verack" - GetAddr Type = "getaddr" - Addr Type = "addr" - GetHeaders Type = "getheaders" - Headers Type = "headers" - GetBlocks Type = "getblocks" - Inv Type = "inv" - GetData Type = "getdata" - Block Type = "block" - TX Type = "tx" - Consensus Type = "consensus" - Unknown Type = "unknown" -) diff --git a/pkg/network/message.go b/pkg/network/message.go index 2154c848e..1af230ab0 100644 --- a/pkg/network/message.go +++ b/pkg/network/message.go @@ -66,6 +66,9 @@ const ( CMDFilterClear CommandType = "filterclear" CMDFilterLoad CommandType = "filterload" CMDMerkleBlock CommandType = "merkleblock" + CMDMempool CommandType = "mempool" + CMDPing CommandType = "ping" + CMDPong CommandType = "pong" ) // NewMessage returns a new message with the given payload. @@ -131,6 +134,12 @@ func (m *Message) CommandType() CommandType { return CMDFilterAdd case "filterclear": return CMDFilterClear + case "mempool": + return CMDMempool + case "ping": + return CMDPing + case "pong": + return CMDPong default: return CMDUnknown }