From fd4df9221ee5c0f50ba1c4e39b645c0fa2f974b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?rich=CE=9Brd?= Date: Fri, 8 Dec 2023 11:55:15 -0400 Subject: [PATCH] fix(lightpush): register lightpush protocol when instantiated (#951) --- waku/v2/protocol/lightpush/waku_lightpush.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/waku/v2/protocol/lightpush/waku_lightpush.go b/waku/v2/protocol/lightpush/waku_lightpush.go index 5cdcc6c3..361f12ba 100644 --- a/waku/v2/protocol/lightpush/waku_lightpush.go +++ b/waku/v2/protocol/lightpush/waku_lightpush.go @@ -53,6 +53,10 @@ func NewWakuLightPush(relay *relay.WakuRelay, pm *peermanager.PeerManager, reg p wakuLP.pm = pm wakuLP.metrics = newMetrics(reg) + if pm != nil { + wakuLP.pm.RegisterWakuProtocol(LightPushID_v20beta1, LightPushENRField) + } + return wakuLP } @@ -73,9 +77,6 @@ func (wakuLP *WakuLightPush) Start(ctx context.Context) error { wakuLP.h.SetStreamHandlerMatch(LightPushID_v20beta1, protocol.PrefixTextMatch(string(LightPushID_v20beta1)), wakuLP.onRequest(ctx)) wakuLP.log.Info("Light Push protocol started") - if wakuLP.pm != nil { - wakuLP.pm.RegisterWakuProtocol(LightPushID_v20beta1, LightPushENRField) - } return nil }