Skip to content

Commit

Permalink
fix: log enr only after it has been setup
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-ramos committed Sep 8, 2023
1 parent cc28267 commit aa0660d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/waku/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"time"

cli "github.com/urfave/cli/v2"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v2/altsrc"
"github.com/waku-org/go-waku/waku/cliutils"
)
Expand Down
2 changes: 2 additions & 0 deletions waku/v2/node/localnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ func (w *WakuNode) setupENR(ctx context.Context, addrs []ma.Multiaddr) error {
}
}

w.enrChangeCh <- struct{}{}

return nil

}
Expand Down
7 changes: 4 additions & 3 deletions waku/v2/node/wakunode2.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
}
}
}
}
Expand Down

0 comments on commit aa0660d

Please sign in to comment.