mirror of
https://github.com/waku-org/nwaku.git
synced 2025-02-05 11:34:45 +00:00
fix: checking for keystore file existence (#2427)
This commit is contained in:
parent
22026b7e89
commit
8f487a2179
@ -223,6 +223,13 @@ suite "Onchain group manager":
|
|||||||
rlnInstance: manager.rlnInstance)
|
rlnInstance: manager.rlnInstance)
|
||||||
expect(ValueError): await manager2.init()
|
expect(ValueError): await manager2.init()
|
||||||
|
|
||||||
|
asyncTest "should error when keystore path and password are provided but file doesn't exist":
|
||||||
|
let manager = await setup()
|
||||||
|
manager.keystorePath = some("/inexistent/file")
|
||||||
|
manager.keystorePassword = some("password")
|
||||||
|
|
||||||
|
expect(CatchableError): await manager.init()
|
||||||
|
|
||||||
asyncTest "startGroupSync: should start group sync":
|
asyncTest "startGroupSync: should start group sync":
|
||||||
let manager = await setup()
|
let manager = await setup()
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ else:
|
|||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import
|
import
|
||||||
|
os,
|
||||||
web3,
|
web3,
|
||||||
web3/ethtypes,
|
web3/ethtypes,
|
||||||
eth/keys as keys,
|
eth/keys as keys,
|
||||||
@ -630,6 +631,10 @@ method init*(g: OnchainGroupManager): Future[void] {.async.} =
|
|||||||
g.registryContract = some(registryContract)
|
g.registryContract = some(registryContract)
|
||||||
|
|
||||||
if g.keystorePath.isSome() and g.keystorePassword.isSome():
|
if g.keystorePath.isSome() and g.keystorePassword.isSome():
|
||||||
|
if not existsFile(g.keystorePath.get()):
|
||||||
|
error "File provided as keystore path does not exist", path=g.keystorePath.get()
|
||||||
|
raise newException(CatchableError, "missing keystore")
|
||||||
|
|
||||||
var keystoreQuery = KeystoreMembership(
|
var keystoreQuery = KeystoreMembership(
|
||||||
membershipContract: MembershipContract(
|
membershipContract: MembershipContract(
|
||||||
chainId: $g.chainId.get(),
|
chainId: $g.chainId.get(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user