mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-02-09 16:33:35 +00:00
[WIP] initialize EligibilityManager properly
This commit is contained in:
parent
1e1d89ec93
commit
3cd3e58fec
@ -42,6 +42,7 @@ proc build*(b: EligibilityConfBuilder): Result[Option[EligibilityConf], string]
|
||||
debug "eligibility: EligibilityConf validation failed - payment amount is zero"
|
||||
return err("Eligibility: payment amount must be above zero")
|
||||
|
||||
# FIXME: how to reuse Eth RPC URL from RLN (?) config?
|
||||
let urls = b.ethClientUrls.get(@[])
|
||||
if urls.len == 0:
|
||||
debug "eligibility: EligibilityConf validation failed - no eth rpc urls"
|
||||
|
||||
@ -519,7 +519,7 @@ type WakuNodeConf* = object
|
||||
reliabilityEnabled* {.
|
||||
desc:
|
||||
"""Adds an extra effort in the delivery/reception of messages by leveraging store-v3 requests.
|
||||
with the drawback of consuming some more bandwidth.""",
|
||||
with the drawback of consuming some more bandwidth.""",
|
||||
defaultValue: false,
|
||||
name: "reliability"
|
||||
.}: bool
|
||||
|
||||
@ -36,7 +36,8 @@ import
|
||||
../node/peer_manager/peer_store/migrations as peer_store_sqlite_migrations,
|
||||
../waku_lightpush_legacy/common,
|
||||
../common/rate_limit/setting,
|
||||
../common/databases/dburl
|
||||
../common/databases/dburl,
|
||||
../incentivization/eligibility_manager
|
||||
|
||||
## Peer persistence
|
||||
|
||||
@ -439,9 +440,22 @@ proc setupProtocols(
|
||||
return
|
||||
err("failed to set node waku peer-exchange peer: " & peerExchangeNode.error)
|
||||
|
||||
# set up eligibility check (i13n POC)
|
||||
# check that: rlnRelay is mounted; Lightpush is mounted
|
||||
# FIXME: conf items are not propagated here; where are they parsed?
|
||||
# initialize eligibility manager if eligibility is enabled
|
||||
if conf.eligibilityConf.isSome() and conf.eligibilityConf.get().enabled:
|
||||
# Check that RLN Relay and Lightpush are mounted
|
||||
if node.wakuRlnRelay.isNil or node.wakuLightPush.isNil:
|
||||
return err("Eligibility manager requires both RLN Relay and Lightpush protocols to be mounted")
|
||||
let ethUrl = conf.eligibilityConf.get().ethClientUrls[0]
|
||||
try:
|
||||
let manager = await EligibilityManager.init(ethUrl)
|
||||
node.peerManager.eligibilityManager = some(manager)
|
||||
except CatchableError:
|
||||
return err("failed to initialize eligibility manager: " & getCurrentExceptionMsg())
|
||||
|
||||
|
||||
# TODO: figure out where to store conf: expected address and expected amount
|
||||
# NOtE: consider both client's and server's perspective!
|
||||
|
||||
#if conf.eligibilityEnabled:
|
||||
# debug "i13n: eligibility enabled!"
|
||||
# debug "eligibilityReceiverAddress:", conf.eligibilityReceiverAddress
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user