aboutsummaryrefslogtreecommitdiffstats
path: root/ethwire/messaging.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-08-21 21:46:26 +0800
committerobscuren <geffobscura@gmail.com>2014-08-21 21:46:26 +0800
commit0af0f0d890120e007ce42f072e1ee179a62115d3 (patch)
tree5ae9ecafbb729d1636fadfcfa49fd9100959560c /ethwire/messaging.go
parentd761af84c83ae8d9d723e6766abb7950ff59cdf3 (diff)
parentc173e9f4ab463cf3a44d35215bc29d846d6f6b02 (diff)
downloadgo-tangerine-0af0f0d890120e007ce42f072e1ee179a62115d3.tar
go-tangerine-0af0f0d890120e007ce42f072e1ee179a62115d3.tar.gz
go-tangerine-0af0f0d890120e007ce42f072e1ee179a62115d3.tar.bz2
go-tangerine-0af0f0d890120e007ce42f072e1ee179a62115d3.tar.lz
go-tangerine-0af0f0d890120e007ce42f072e1ee179a62115d3.tar.xz
go-tangerine-0af0f0d890120e007ce42f072e1ee179a62115d3.tar.zst
go-tangerine-0af0f0d890120e007ce42f072e1ee179a62115d3.zip
Merge branch 'release/0.6.3'
Diffstat (limited to 'ethwire/messaging.go')
-rw-r--r--ethwire/messaging.go57
1 files changed, 33 insertions, 24 deletions
diff --git a/ethwire/messaging.go b/ethwire/messaging.go
index f13b72353..7ac0188a1 100644
--- a/ethwire/messaging.go
+++ b/ethwire/messaging.go
@@ -6,9 +6,10 @@ import (
"bytes"
"errors"
"fmt"
- "github.com/ethereum/eth-go/ethutil"
"net"
"time"
+
+ "github.com/ethereum/eth-go/ethutil"
)
// Connection interface describing the methods required to implement the wire protocol.
@@ -26,33 +27,41 @@ const (
// Values are given explicitly instead of by iota because these values are
// defined by the wire protocol spec; it is easier for humans to ensure
// correctness when values are explicit.
- MsgHandshakeTy = 0x00
- MsgDiscTy = 0x01
- MsgPingTy = 0x02
- MsgPongTy = 0x03
- MsgGetPeersTy = 0x10
- MsgPeersTy = 0x11
- MsgTxTy = 0x12
- MsgBlockTy = 0x13
- MsgGetChainTy = 0x14
- MsgNotInChainTy = 0x15
- MsgGetTxsTy = 0x16
+ MsgHandshakeTy = 0x00
+ MsgDiscTy = 0x01
+ MsgPingTy = 0x02
+ MsgPongTy = 0x03
+ MsgGetPeersTy = 0x10
+ MsgPeersTy = 0x11
+ MsgTxTy = 0x12
+ MsgGetChainTy = 0x14
+ MsgNotInChainTy = 0x15
+ MsgGetTxsTy = 0x16
+ MsgGetBlockHashesTy = 0x17
+ MsgBlockHashesTy = 0x18
+ MsgGetBlocksTy = 0x19
+ MsgBlockTy = 0x13
+
+ MsgOldBlockTy = 0xbb
MsgTalkTy = 0xff
)
var msgTypeToString = map[MsgType]string{
- MsgHandshakeTy: "Handshake",
- MsgDiscTy: "Disconnect",
- MsgPingTy: "Ping",
- MsgPongTy: "Pong",
- MsgGetPeersTy: "Get peers",
- MsgPeersTy: "Peers",
- MsgTxTy: "Transactions",
- MsgBlockTy: "Blocks",
- MsgGetChainTy: "Get chain",
- MsgGetTxsTy: "Get Txs",
- MsgNotInChainTy: "Not in chain",
+ MsgHandshakeTy: "Handshake",
+ MsgDiscTy: "Disconnect",
+ MsgPingTy: "Ping",
+ MsgPongTy: "Pong",
+ MsgGetPeersTy: "Get peers",
+ MsgPeersTy: "Peers",
+ MsgTxTy: "Transactions",
+ MsgBlockTy: "Blocks",
+ MsgGetChainTy: "Get chain",
+ MsgGetTxsTy: "Get Txs",
+ MsgNotInChainTy: "Not in chain",
+ MsgGetBlockHashesTy: "Get block hashes",
+ MsgBlockHashesTy: "Block hashes",
+ MsgGetBlocksTy: "Get blocks",
}
func (mt MsgType) String() string {
@@ -109,7 +118,7 @@ func (self *Connection) Write(typ MsgType, v ...interface{}) error {
slice := [][]interface{}{[]interface{}{byte(typ)}}
for _, value := range v {
- if encodable, ok := value.(ethutil.RlpEncodable); ok {
+ if encodable, ok := value.(ethutil.RlpEncodeDecode); ok {
slice = append(slice, encodable.RlpValue())
} else if raw, ok := value.([]interface{}); ok {
slice = append(slice, raw)