mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 05:14:14 +00:00
config: fixes bug networkid parser
previously it mistakenly parse into the `result` now it correctly parse networkId into res.
This commit is contained in:
parent
c69e57e5d4
commit
1da4346295
@ -546,7 +546,7 @@ proc processNetArguments(key, value: string): ConfigStatus =
|
||||
var res = 0
|
||||
result = processInteger(value, res)
|
||||
if result == Success:
|
||||
config.net.setNetwork(NetworkId(result))
|
||||
config.net.setNetwork(NetworkId(res))
|
||||
config.net.flags.incl NetworkIdSet
|
||||
elif skey == "nodiscover":
|
||||
config.net.flags.incl(NoDiscover)
|
||||
|
@ -1,11 +1,14 @@
|
||||
import
|
||||
std/[os, parseopt],
|
||||
unittest2, stew/byteutils,
|
||||
eth/common/eth_types,
|
||||
../nimbus/vm_internals
|
||||
eth/p2p,
|
||||
../nimbus/vm_internals,
|
||||
../nimbus/config
|
||||
|
||||
func toAddress(n: int): EthAddress =
|
||||
result[19] = n.byte
|
||||
|
||||
|
||||
func toAddress(a, b: int): EthAddress =
|
||||
result[18] = a.byte
|
||||
result[19] = b.byte
|
||||
@ -22,5 +25,17 @@ proc miscMain*() =
|
||||
check toAddress(0x10, 0x0).toInt == 0x1000
|
||||
check toAddress(0x10, 0x0, 0x0).toInt == 0x100000
|
||||
|
||||
test "networkid cli":
|
||||
var msg: string
|
||||
const genesisFile = "tests" / "customgenesis" / "calaveras.json"
|
||||
var opt = initOptParser("--customnetwork:" & genesisFile & " --networkid:123")
|
||||
let res = processArguments(msg, opt)
|
||||
if res != Success:
|
||||
echo msg
|
||||
quit(QuitFailure)
|
||||
|
||||
let conf = getConfiguration()
|
||||
check conf.net.networkId == 123.NetworkId
|
||||
|
||||
when isMainModule:
|
||||
miscMain()
|
||||
|
Loading…
x
Reference in New Issue
Block a user