Fix argument to be optional.
This commit is contained in:
parent
19e3c8b4e4
commit
17960d7e99
|
@ -163,7 +163,7 @@ type
|
||||||
|
|
||||||
validatorsSource* {.
|
validatorsSource* {.
|
||||||
desc: "Remote Web3Signer URL that will be used as a source of validators"
|
desc: "Remote Web3Signer URL that will be used as a source of validators"
|
||||||
name: "validators-source"}: string
|
name: "validators-source"}: Option[string]
|
||||||
|
|
||||||
secretsDirFlag* {.
|
secretsDirFlag* {.
|
||||||
desc: "A directory containing validator keystore passwords"
|
desc: "A directory containing validator keystore passwords"
|
||||||
|
@ -881,7 +881,7 @@ type
|
||||||
|
|
||||||
validatorsSource* {.
|
validatorsSource* {.
|
||||||
desc: "Remote Web3Signer URL that will be used as a source of validators"
|
desc: "Remote Web3Signer URL that will be used as a source of validators"
|
||||||
name: "validators-source"}: string
|
name: "validators-source"}: Option[string]
|
||||||
|
|
||||||
secretsDirFlag* {.
|
secretsDirFlag* {.
|
||||||
desc: "A directory containing validator keystore passwords"
|
desc: "A directory containing validator keystore passwords"
|
||||||
|
|
|
@ -630,24 +630,27 @@ proc existsKeystore(keystoreDir: string,
|
||||||
proc queryValidatorsSource*(config: AnyConf): Future[seq[KeystoreData]] {.
|
proc queryValidatorsSource*(config: AnyConf): Future[seq[KeystoreData]] {.
|
||||||
async.} =
|
async.} =
|
||||||
var keystores: seq[KeystoreData]
|
var keystores: seq[KeystoreData]
|
||||||
if len(config.validatorsSource) == 0:
|
if config.validatorsSource.isNone() or
|
||||||
|
len(config.validatorsSource.get()) == 0:
|
||||||
return keystores
|
return keystores
|
||||||
|
|
||||||
|
let vsource = config.validatorsSource.get()
|
||||||
|
logScope:
|
||||||
|
validators_source = vsource
|
||||||
|
|
||||||
let
|
let
|
||||||
httpFlags: HttpClientFlags = {}
|
httpFlags: HttpClientFlags = {}
|
||||||
prestoFlags = {RestClientFlag.CommaSeparatedArray}
|
prestoFlags = {RestClientFlag.CommaSeparatedArray}
|
||||||
socketFlags = {SocketFlags.TcpNoDelay}
|
socketFlags = {SocketFlags.TcpNoDelay}
|
||||||
client =
|
client =
|
||||||
block:
|
block:
|
||||||
let res = RestClientRef.new(config.validatorsSource, prestoFlags,
|
let res = RestClientRef.new(vsource, prestoFlags,
|
||||||
httpFlags, socketFlags = socketFlags)
|
httpFlags, socketFlags = socketFlags)
|
||||||
if res.isErr():
|
if res.isErr():
|
||||||
# TODO keep trying in case of temporary network failure
|
# TODO keep trying in case of temporary network failure
|
||||||
warn "Unable to resolve validator's source distributed signer " &
|
warn "Unable to resolve validator's source distributed signer address"
|
||||||
"address", remote_url = config.validatorsSource
|
|
||||||
return keystores
|
return keystores
|
||||||
else:
|
res.get()
|
||||||
res.get()
|
|
||||||
keys =
|
keys =
|
||||||
try:
|
try:
|
||||||
let response = await getKeysPlain(client)
|
let response = await getKeysPlain(client)
|
||||||
|
@ -681,7 +684,7 @@ proc queryValidatorsSource*(config: AnyConf): Future[seq[KeystoreData]] {.
|
||||||
handle: FileLockHandle(opened: false),
|
handle: FileLockHandle(opened: false),
|
||||||
pubkey: pubkey,
|
pubkey: pubkey,
|
||||||
remotes: @[RemoteSignerInfo(
|
remotes: @[RemoteSignerInfo(
|
||||||
url: HttpHostUri(parseUri(config.validatorsSource)),
|
url: HttpHostUri(parseUri(vsource)),
|
||||||
pubkey: pubkey)],
|
pubkey: pubkey)],
|
||||||
flags: {RemoteKeystoreFlag.DynamicKeystore},
|
flags: {RemoteKeystoreFlag.DynamicKeystore},
|
||||||
remoteType: RemoteSignerType.Web3Signer))
|
remoteType: RemoteSignerType.Web3Signer))
|
||||||
|
|
Loading…
Reference in New Issue