fix: log enr only after it has been setup

This commit is contained in:
Richard Ramos 2023-09-08 15:19:23 -04:00 committed by richΛrd
parent cc28267951
commit db3a2d53b3
2 changed files with 6 additions and 3 deletions

View File

@ -281,6 +281,8 @@ func (w *WakuNode) setupENR(ctx context.Context, addrs []ma.Multiaddr) error {
}
}
w.enrChangeCh <- struct{}{}
return nil
}

View File

@ -310,7 +310,6 @@ func (w *WakuNode) watchMultiaddressChanges(ctx context.Context) {
return
case <-first:
w.log.Info("listening", logging.MultiAddrs("multiaddr", addrs...))
w.enrChangeCh <- struct{}{}
case <-w.addressChangesSub.Out():
newAddrs := w.ListenAddresses()
diff := false
@ -327,8 +326,10 @@ func (w *WakuNode) watchMultiaddressChanges(ctx context.Context) {
if diff {
addrs = newAddrs
w.log.Info("listening addresses update received", logging.MultiAddrs("multiaddr", addrs...))
_ = w.setupENR(ctx, addrs)
w.enrChangeCh <- struct{}{}
err := w.setupENR(ctx, addrs)
if err != nil {
w.log.Warn("could not update ENR", zap.Error(err))
}
}
}
}