From 5d7d05ca16a52b035118a89ce732379c67ee25c6 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Tue, 22 Nov 2022 19:46:56 -0400 Subject: [PATCH] fix: restart discv5 --- waku/v2/node/localnode.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/waku/v2/node/localnode.go b/waku/v2/node/localnode.go index 742963e5..4ae3683c 100644 --- a/waku/v2/node/localnode.go +++ b/waku/v2/node/localnode.go @@ -237,6 +237,16 @@ func (w *WakuNode) setupENR(addrs []ma.Multiaddr) error { return err } else { w.log.Info("enr record", logging.ENode("enr", w.localNode.Node())) + // Restarting DiscV5 + if w.discoveryV5 != nil && w.discoveryV5.IsStarted() { + w.log.Info("restarting discv5") + w.discoveryV5.Stop() + err = w.discoveryV5.Start() + if err != nil { + w.log.Error("could not restart discv5", zap.Error(err)) + return err + } + } } } else { localNode, err := w.newLocalnode(w.opts.privKey, wsAddresses, ipAddr, w.opts.udpPort, w.wakuFlag, w.opts.advertiseAddr, w.log)