73
73
abbr: " i"
74
74
name: " network" }: string
75
75
76
- customNetwork {.
77
- desc : " Use custom genesis block for private Ethereum Network (as /path/to/genesis.json)"
78
- defaultValueDesc: " "
79
- abbr: " c"
80
- name: " custom-network" }: Option [NetworkParams ]
76
+ customNetworkFolder* {.
77
+ desc : " Use custom config for private Ethereum Network (as /path/to/metadata)"
78
+ longDesc:
79
+ " Path to a folder containing custom network configuration files\n " &
80
+ " such as genesis.json, config.yaml, etc.\n " &
81
+ " config.yaml is the configuration file for the CL client"
82
+ defaultValue: " "
83
+ name: " custom-network" .}: string
81
84
82
85
networkId* {.
83
86
ignore # this field is not processed by confutils
@@ -187,8 +190,12 @@ proc makeConfig*(cmdLine = commandLineParams()): NRpcConf
187
190
188
191
var networkId = result .getNetworkId ()
189
192
190
- if result .customNetwork.isSome:
191
- result .networkParams = result .customNetwork.get ()
193
+ if result .customNetworkFolder.len > 0 :
194
+ var networkParams = NetworkParams ()
195
+ if not loadNetworkParams (result .customNetworkFolder.joinPath (" genesis.json" ), networkParams):
196
+ error " Failed to load customNetwork" , path= result .customNetworkFolder
197
+ quit QuitFailure
198
+ result .networkParams = networkParams
192
199
if networkId.isNone:
193
200
# WARNING: networkId and chainId are two distinct things
194
201
# they usage should not be mixed in other places.
@@ -204,7 +211,7 @@ proc makeConfig*(cmdLine = commandLineParams()): NRpcConf
204
211
205
212
result .networkId = networkId.get ()
206
213
207
- if result .customNetwork.isNone :
214
+ if result .customNetworkFolder.len == 0 :
208
215
result .networkParams = networkParams (result .networkId)
209
216
210
217
0 commit comments