mirror of
https://github.com/waku-org/nwaku.git
synced 2025-02-28 23:10:54 +00:00
fix(rln-db-inspector): use valueOr pattern (#2012)
This commit is contained in:
parent
ec42e2c758
commit
a8095d871e
@ -19,29 +19,23 @@ logScope:
|
|||||||
when isMainModule:
|
when isMainModule:
|
||||||
{.pop.}
|
{.pop.}
|
||||||
# 1. load configuration
|
# 1. load configuration
|
||||||
let conf = RlnDbInspectorConf.loadConfig().isOkOr:
|
let conf = RlnDbInspectorConf.loadConfig().valueOr:
|
||||||
error "failure while loading the configuration", error=confRes.error
|
error "failure while loading the configuration", error
|
||||||
quit(1)
|
quit(1)
|
||||||
|
|
||||||
trace "configuration", conf = $conf
|
trace "configuration", conf = $conf
|
||||||
|
|
||||||
# 2. initialize rlnInstance
|
# 2. initialize rlnInstance
|
||||||
let rlnInstanceRes = createRLNInstance(d=20,
|
let rlnInstance = createRLNInstance(d=20,
|
||||||
tree_path = conf.rlnRelayTreePath)
|
tree_path = conf.rlnRelayTreePath).valueOr:
|
||||||
if rlnInstanceRes.isErr():
|
error "failure while creating RLN instance", error
|
||||||
error "failure while creating RLN instance", error=rlnInstanceRes.error
|
|
||||||
quit(1)
|
quit(1)
|
||||||
|
|
||||||
let rlnInstance = rlnInstanceRes.get()
|
|
||||||
|
|
||||||
# 3. get metadata
|
# 3. get metadata
|
||||||
let metadataGetRes = rlnInstance.getMetadata()
|
let metadata = rlnInstance.getMetadata().valueOr:
|
||||||
if metadataGetRes.isErr():
|
error "failure while getting RLN metadata", error
|
||||||
error "failure while getting RLN metadata", error=metadataGetRes.error
|
|
||||||
quit(1)
|
quit(1)
|
||||||
|
|
||||||
let metadata = metadataGetRes.get()
|
|
||||||
|
|
||||||
info "RLN metadata", lastProcessedBlock = metadata.lastProcessedBlock,
|
info "RLN metadata", lastProcessedBlock = metadata.lastProcessedBlock,
|
||||||
chainId = metadata.chainId,
|
chainId = metadata.chainId,
|
||||||
contractAddress = metadata.contractAddress,
|
contractAddress = metadata.contractAddress,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user