mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 13:24:21 +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
|
var res = 0
|
||||||
result = processInteger(value, res)
|
result = processInteger(value, res)
|
||||||
if result == Success:
|
if result == Success:
|
||||||
config.net.setNetwork(NetworkId(result))
|
config.net.setNetwork(NetworkId(res))
|
||||||
config.net.flags.incl NetworkIdSet
|
config.net.flags.incl NetworkIdSet
|
||||||
elif skey == "nodiscover":
|
elif skey == "nodiscover":
|
||||||
config.net.flags.incl(NoDiscover)
|
config.net.flags.incl(NoDiscover)
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
import
|
import
|
||||||
|
std/[os, parseopt],
|
||||||
unittest2, stew/byteutils,
|
unittest2, stew/byteutils,
|
||||||
eth/common/eth_types,
|
eth/common/eth_types,
|
||||||
../nimbus/vm_internals
|
eth/p2p,
|
||||||
|
../nimbus/vm_internals,
|
||||||
|
../nimbus/config
|
||||||
|
|
||||||
func toAddress(n: int): EthAddress =
|
func toAddress(n: int): EthAddress =
|
||||||
result[19] = n.byte
|
result[19] = n.byte
|
||||||
@ -22,5 +25,17 @@ proc miscMain*() =
|
|||||||
check toAddress(0x10, 0x0).toInt == 0x1000
|
check toAddress(0x10, 0x0).toInt == 0x1000
|
||||||
check toAddress(0x10, 0x0, 0x0).toInt == 0x100000
|
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:
|
when isMainModule:
|
||||||
miscMain()
|
miscMain()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user