Eth65: Rename and stop exporting `protocolVersion`

This constant shouldn't be used outside `protocol_eth65`.

When we support multiple `eth/NN` versions side by side, or even just have
multiple code files, there's a risk some code would import just one of the
files (e.g. `protocol_eth65`), use `protocolVersion`, and incorrectly act as
though that version is the one active on the node.

In fact that happened, and now it can't happen.  Other code needs to query the
`EtheruemNode` to find what versions are really active.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
This commit is contained in:
Jamie Lokier 2021-07-27 00:36:49 +01:00
parent 5ddfd7dd05
commit 936a18b4f4
No known key found for this signature in database
GPG Key ID: CBC25C68435C30A2
1 changed files with 4 additions and 4 deletions

View File

@ -37,11 +37,11 @@ const
maxBodiesFetch* = 128
maxReceiptsFetch* = 256
maxHeadersFetch* = 192
protocolVersion* = 65
ethVersion = 65
func toHex(x: KeccakHash): string = x.data.toHex
p2pProtocol eth(version = protocolVersion,
p2pProtocol eth(version = ethVersion,
peerState = PeerState,
useRequestIds = false):
@ -56,7 +56,7 @@ p2pProtocol eth(version = protocolVersion,
forkNext: chainForkId.nextFork.u256,
)
let m = await peer.status(protocolVersion,
let m = await peer.status(ethVersion,
network.networkId,
bestBlock.difficulty,
bestBlock.blockHash,
@ -82,7 +82,7 @@ p2pProtocol eth(version = protocolVersion,
handshake:
# User message 0x00: Status.
proc status(peer: Peer,
protocolVersion: uint,
ethVersionArg: uint,
networkId: NetworkId,
totalDifficulty: DifficultyInt,
bestHash: KeccakHash,