aboutsummaryrefslogtreecommitdiffstats
path: root/eth/protocol.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-07-01 23:16:44 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-07-01 23:16:44 +0800
commit5caff3bc247cdd71f2342093d276041afe898ab3 (patch)
treea771298f17987eba6fb05d7bac1e772121296856 /eth/protocol.go
parent507869bff10adab3d4f183aeaf3ef31715041046 (diff)
parentd6f2c0a76f6635ebeb245815c5f686c545ed527d (diff)
downloaddexon-5caff3bc247cdd71f2342093d276041afe898ab3.tar
dexon-5caff3bc247cdd71f2342093d276041afe898ab3.tar.gz
dexon-5caff3bc247cdd71f2342093d276041afe898ab3.tar.bz2
dexon-5caff3bc247cdd71f2342093d276041afe898ab3.tar.lz
dexon-5caff3bc247cdd71f2342093d276041afe898ab3.tar.xz
dexon-5caff3bc247cdd71f2342093d276041afe898ab3.tar.zst
dexon-5caff3bc247cdd71f2342093d276041afe898ab3.zip
Merge pull request #1351 from karalabe/eth61
Implement eth/61
Diffstat (limited to 'eth/protocol.go')
-rw-r--r--eth/protocol.go38
1 files changed, 33 insertions, 5 deletions
diff --git a/eth/protocol.go b/eth/protocol.go
index 57805d9bd..bf9e155c5 100644
--- a/eth/protocol.go
+++ b/eth/protocol.go
@@ -7,11 +7,15 @@ import (
"github.com/ethereum/go-ethereum/core/types"
)
+// Supported versions of the eth protocol (first is primary).
+var ProtocolVersions = []uint{61, 60}
+
+// Number of implemented message corresponding to different protocol versions.
+var ProtocolLengths = []uint64{9, 8}
+
const (
- ProtocolVersion = 60
NetworkId = 0
- ProtocolLength = uint64(8)
- ProtocolMaxMsgSize = 10 * 1024 * 1024
+ ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message
)
// eth protocol message codes
@@ -24,6 +28,7 @@ const (
GetBlocksMsg
BlocksMsg
NewBlockMsg
+ GetBlockHashesFromNumberMsg
)
type errCode int
@@ -72,8 +77,31 @@ type chainManager interface {
Status() (td *big.Int, currentBlock common.Hash, genesisBlock common.Hash)
}
-// message structs used for RLP serialization
-type newBlockMsgData struct {
+// statusData is the network packet for the status message.
+type statusData struct {
+ ProtocolVersion uint32
+ NetworkId uint32
+ TD *big.Int
+ CurrentBlock common.Hash
+ GenesisBlock common.Hash
+}
+
+// getBlockHashesData is the network packet for the hash based block retrieval
+// message.
+type getBlockHashesData struct {
+ Hash common.Hash
+ Amount uint64
+}
+
+// getBlockHashesFromNumberData is the network packet for the number based block
+// retrieval message.
+type getBlockHashesFromNumberData struct {
+ Number uint64
+ Amount uint64
+}
+
+// newBlockData is the network packet for the block propagation message.
+type newBlockData struct {
Block *types.Block
TD *big.Int
}