mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-11 12:54:13 +00:00
Better cmdline flags handling
This commit is contained in:
parent
74f6f0b738
commit
291fddee71
@ -367,7 +367,7 @@ proc processNetArguments(key, value: string): ConfigStatus =
|
|||||||
let config = getConfiguration()
|
let config = getConfiguration()
|
||||||
let skey = key.toLowerAscii()
|
let skey = key.toLowerAscii()
|
||||||
if skey == "bootnodes":
|
if skey == "bootnodes":
|
||||||
result = processENodesList(value, config.net.bootnodes)
|
result = processENodesList(value, config.net.bootNodes)
|
||||||
elif skey == "bootnodesv4":
|
elif skey == "bootnodesv4":
|
||||||
result = processENodesList(value, config.net.bootNodes)
|
result = processENodesList(value, config.net.bootNodes)
|
||||||
elif skey == "bootnodesv5":
|
elif skey == "bootnodesv5":
|
||||||
@ -511,7 +511,7 @@ NETWORKING OPTIONS:
|
|||||||
--bootnodesv4:<value> Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes)
|
--bootnodesv4:<value> Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes)
|
||||||
--bootnodesv5:<value> Comma separated enode URLs for P2P v5 discovery bootstrap (light server, light nodes)
|
--bootnodesv5:<value> Comma separated enode URLs for P2P v5 discovery bootstrap (light server, light nodes)
|
||||||
--port:<value> Network listening TCP port (default: 30303)
|
--port:<value> Network listening TCP port (default: 30303)
|
||||||
--discport:<value> Network listening UDP port (default: 30303)
|
--discport:<value> Network listening UDP port (defaults to --port argument)
|
||||||
--maxpeers:<value> Maximum number of network peers (default: 25)
|
--maxpeers:<value> Maximum number of network peers (default: 25)
|
||||||
--maxpendpeers:<value> Maximum number of pending connection attempts (default: 0)
|
--maxpendpeers:<value> Maximum number of pending connection attempts (default: 0)
|
||||||
--nodiscover Disables the peer discovery mechanism (manual peer addition)
|
--nodiscover Disables the peer discovery mechanism (manual peer addition)
|
||||||
@ -538,7 +538,11 @@ LOGGING AND DEBUGGING OPTIONS:
|
|||||||
|
|
||||||
proc processArguments*(msg: var string): ConfigStatus =
|
proc processArguments*(msg: var string): ConfigStatus =
|
||||||
## Process command line argument and update `NimbusConfiguration`.
|
## Process command line argument and update `NimbusConfiguration`.
|
||||||
discard getConfiguration()
|
let config = getConfiguration()
|
||||||
|
var tempBootNodes: seq[ENode]
|
||||||
|
swap(tempBootNodes, config.net.bootNodes)
|
||||||
|
config.net.discPort = 0
|
||||||
|
|
||||||
var opt = initOptParser()
|
var opt = initOptParser()
|
||||||
var length = 0
|
var length = 0
|
||||||
for kind, key, value in opt.getopt():
|
for kind, key, value in opt.getopt():
|
||||||
@ -566,9 +570,11 @@ proc processArguments*(msg: var string): ConfigStatus =
|
|||||||
result = ErrorParseOption
|
result = ErrorParseOption
|
||||||
break
|
break
|
||||||
|
|
||||||
if length == 0 and result == Success:
|
if config.net.bootNodes.len == 0:
|
||||||
# msg = getHelpString()
|
swap(tempBootNodes, config.net.bootNodes)
|
||||||
result = Success
|
|
||||||
|
if config.net.discPort == 0:
|
||||||
|
config.net.discPort = config.net.bindPort
|
||||||
|
|
||||||
proc processConfig*(pathname: string): ConfigStatus =
|
proc processConfig*(pathname: string): ConfigStatus =
|
||||||
## Process configuration file `pathname` and update `NimbusConfiguration`.
|
## Process configuration file `pathname` and update `NimbusConfiguration`.
|
||||||
|
@ -95,7 +95,8 @@ proc start(): NimbusObject =
|
|||||||
result = "EXITING"
|
result = "EXITING"
|
||||||
nimbus.rpcServer.start()
|
nimbus.rpcServer.start()
|
||||||
|
|
||||||
waitFor nimbus.ethNode.connectToNetwork(conf.net.bootNodes)
|
waitFor nimbus.ethNode.connectToNetwork(conf.net.bootNodes,
|
||||||
|
enableDiscovery = NoDiscover notin conf.net.flags)
|
||||||
|
|
||||||
# TODO: temp code until the CLI/RPC interface is fleshed out
|
# TODO: temp code until the CLI/RPC interface is fleshed out
|
||||||
let status = waitFor nimbus.ethNode.fastBlockchainSync()
|
let status = waitFor nimbus.ethNode.fastBlockchainSync()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user