mirror of https://github.com/waku-org/nwaku.git
feat: validate rln relay config when mounting
Fails faster when ethereum client address is not passed.
This commit is contained in:
parent
79b0e2e023
commit
6251dddae2
|
@ -1123,6 +1123,11 @@ proc mountRlnRelay*(
|
||||||
) {.async.} =
|
) {.async.} =
|
||||||
info "mounting rln relay"
|
info "mounting rln relay"
|
||||||
|
|
||||||
|
let validationRes = rlnConf.validate()
|
||||||
|
if validationRes.isErr():
|
||||||
|
echo "it is ERR"
|
||||||
|
raise newException(CatchableError, validationRes.error)
|
||||||
|
|
||||||
if node.wakuRelay.isNil():
|
if node.wakuRelay.isNil():
|
||||||
raise newException(
|
raise newException(
|
||||||
CatchableError, "WakuRelay protocol is not mounted, cannot mount WakuRlnRelay"
|
CatchableError, "WakuRelay protocol is not mounted, cannot mount WakuRlnRelay"
|
||||||
|
|
|
@ -45,6 +45,11 @@ type WakuRlnConfig* = object
|
||||||
onFatalErrorAction*: OnFatalErrorHandler
|
onFatalErrorAction*: OnFatalErrorHandler
|
||||||
rlnRelayUserMessageLimit*: uint64
|
rlnRelayUserMessageLimit*: uint64
|
||||||
|
|
||||||
|
proc validate*(rlnConfig: WakuRlnConfig): Result[void, string] =
|
||||||
|
if rlnConfig.rlnRelayEthClientAddress == "":
|
||||||
|
return err("Rln Relay Eth Client address must be specified")
|
||||||
|
ok()
|
||||||
|
|
||||||
proc createMembershipList*(
|
proc createMembershipList*(
|
||||||
rln: ptr RLN, n: int
|
rln: ptr RLN, n: int
|
||||||
): RlnRelayResult[(seq[RawMembershipCredentials], string)] =
|
): RlnRelayResult[(seq[RawMembershipCredentials], string)] =
|
||||||
|
|
Loading…
Reference in New Issue