fix(rln-relay): segfault when no params except rln-relay is passed in (#2047)

This commit is contained in:
Aaryamann Challani 2023-09-25 13:26:16 +05:30 committed by GitHub
parent afdcfc78b9
commit 45fe2d3bee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -19,7 +19,8 @@ method init*(g: StaticGroupManager): Future[void] {.async,gcsafe.} =
let
groupSize = g.groupSize
groupKeys = g.groupKeys
membershipIndex = g.membershipIndex.get()
membershipIndex = if g.membershipIndex.isSome(): g.membershipIndex.get()
else: raise newException(ValueError, "Membership index is not set")
if membershipIndex < MembershipIndex(0) or membershipIndex >= MembershipIndex(groupSize):
raise newException(ValueError, "Invalid membership index. Must be within 0 and " & $(groupSize - 1) & "but was " & $membershipIndex)

View File

@ -408,7 +408,7 @@ proc isReady*(rlnPeer: WakuRLNRelay): Future[bool] {.async.} =
proc new*(T: type WakuRlnRelay,
conf: WakuRlnConfig,
registrationHandler: Option[RegistrationHandler] = none(RegistrationHandler)
registrationHandler = none(RegistrationHandler)
): Future[RlnRelayResult[WakuRlnRelay]] {.async.} =
## Mounts the rln-relay protocol on the node.
## The rln-relay protocol can be mounted in two modes: on-chain and off-chain.