aboutsummaryrefslogtreecommitdiffstats
path: root/eth/protocol.go
diff options
context:
space:
mode:
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
}