forked from cerc-io/plugeth
eth: introduce eth67 protocol (#24093)
The new protocol version removes support for GetNodeData. See https://eips.ethereum.org/EIPS/eip-4938 for more information. Co-authored-by: Felix Lange <fjl@twurst.com> Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
co-authored by
Felix Lange
Martin Holst Swende
parent
3273ad1a58
commit
30602163d5
@@ -181,6 +181,21 @@ var eth66 = map[uint64]msgHandler{
|
||||
PooledTransactionsMsg: handlePooledTransactions66,
|
||||
}
|
||||
|
||||
var eth67 = map[uint64]msgHandler{
|
||||
NewBlockHashesMsg: handleNewBlockhashes,
|
||||
NewBlockMsg: handleNewBlock,
|
||||
TransactionsMsg: handleTransactions,
|
||||
NewPooledTransactionHashesMsg: handleNewPooledTransactionHashes,
|
||||
GetBlockHeadersMsg: handleGetBlockHeaders66,
|
||||
BlockHeadersMsg: handleBlockHeaders66,
|
||||
GetBlockBodiesMsg: handleGetBlockBodies66,
|
||||
BlockBodiesMsg: handleBlockBodies66,
|
||||
GetReceiptsMsg: handleGetReceipts66,
|
||||
ReceiptsMsg: handleReceipts66,
|
||||
GetPooledTransactionsMsg: handleGetPooledTransactions66,
|
||||
PooledTransactionsMsg: handlePooledTransactions66,
|
||||
}
|
||||
|
||||
// handleMessage is invoked whenever an inbound message is received from a remote
|
||||
// peer. The remote connection is torn down upon returning any error.
|
||||
func handleMessage(backend Backend, peer *Peer) error {
|
||||
@@ -195,9 +210,9 @@ func handleMessage(backend Backend, peer *Peer) error {
|
||||
defer msg.Discard()
|
||||
|
||||
var handlers = eth66
|
||||
//if peer.Version() >= ETH67 { // Left in as a sample when new protocol is added
|
||||
// handlers = eth67
|
||||
//}
|
||||
if peer.Version() >= ETH67 {
|
||||
handlers = eth67
|
||||
}
|
||||
|
||||
// Track the amount of time it takes to serve the request and run the handler
|
||||
if metrics.Enabled {
|
||||
|
||||
@@ -31,6 +31,7 @@ import (
|
||||
// Constants to match up protocol versions and messages
|
||||
const (
|
||||
ETH66 = 66
|
||||
ETH67 = 67
|
||||
)
|
||||
|
||||
// ProtocolName is the official short name of the `eth` protocol used during
|
||||
@@ -39,11 +40,11 @@ const ProtocolName = "eth"
|
||||
|
||||
// ProtocolVersions are the supported versions of the `eth` protocol (first
|
||||
// is primary).
|
||||
var ProtocolVersions = []uint{ETH66}
|
||||
var ProtocolVersions = []uint{ETH67, ETH66}
|
||||
|
||||
// protocolLengths are the number of implemented message corresponding to
|
||||
// different protocol versions.
|
||||
var protocolLengths = map[uint]uint64{ETH66: 17}
|
||||
var protocolLengths = map[uint]uint64{ETH67: 17, ETH66: 17}
|
||||
|
||||
// maxMessageSize is the maximum cap on the size of a protocol message.
|
||||
const maxMessageSize = 10 * 1024 * 1024
|
||||
|
||||
Reference in New Issue
Block a user