_pkg.dev: drop wire/command

Transferring some missing commands to pkg/network.
This commit is contained in:
Roman Khimov 2019-08-27 20:08:48 +03:00
parent e89e78159b
commit 0f265a6a04
2 changed files with 9 additions and 29 deletions

View file

@ -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"
)

View file

@ -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
}