mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-03-19 19:13:08 +00:00
add optional reputation manager to Lightpush client initialization
This commit is contained in:
parent
64498403d3
commit
ef67d542ab
@ -27,5 +27,7 @@ proc newTestWakuLightpushNode*(
|
||||
|
||||
proc newTestWakuLightpushClient*(switch: Switch): WakuLightPushClient =
|
||||
let peerManager = PeerManager.new(switch)
|
||||
let reputationManager = ReputationManager.new()
|
||||
WakuLightPushClient.new(peerManager, reputationManager, rng)
|
||||
var reputationManager = none(ReputationManager)
|
||||
when defined(reputation):
|
||||
reputationManager = some(ReputationManager.new())
|
||||
WakuLightPushClient.new(peerManager, rng, reputationManager)
|
||||
|
||||
@ -26,12 +26,15 @@ type WakuLightPushClient* = ref object
|
||||
proc new*(
|
||||
T: type WakuLightPushClient,
|
||||
peerManager: PeerManager,
|
||||
reputationManager: ReputationManager,
|
||||
rng: ref rand.HmacDrbgContext,
|
||||
reputationManager: Option[ReputationManager] = none(ReputationManager),
|
||||
): T =
|
||||
WakuLightPushClient(
|
||||
peerManager: peerManager, reputationManager: reputationManager, rng: rng
|
||||
)
|
||||
if reputationManager.isSome:
|
||||
WakuLightPushClient(
|
||||
peerManager: peerManager, rng: rng, reputationManager: reputationManager.get()
|
||||
)
|
||||
else:
|
||||
WakuLightPushClient(peerManager: peerManager, rng: rng)
|
||||
|
||||
proc addPublishObserver*(wl: WakuLightPushClient, obs: PublishObserver) =
|
||||
wl.publishObservers.add(obs)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user