fix: restart discv5

This commit is contained in:
Richard Ramos 2022-11-22 19:46:56 -04:00
parent df4e182266
commit 5d7d05ca16
No known key found for this signature in database
GPG Key ID: BD36D48BC9FFC88C
1 changed files with 10 additions and 0 deletions

View File

@ -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)