Skip to content

Commit

Permalink
Node: p2p address discovery change
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley committed Nov 19, 2024
1 parent 9895f74 commit 0548ea6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions node/pkg/p2p/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ func NewHost(logger *zap.Logger, ctx context.Context, networkID string, bootstra
)
}

h, err := libp2p.New(
// The default libp2p options.
opts := []libp2p.Option{
// Use the keypair we generated
libp2p.Identity(priv),

Expand Down Expand Up @@ -285,9 +286,14 @@ func NewHost(logger *zap.Logger, ctx context.Context, networkID string, bootstra
)
return idht, err
}),
)
}

// If the external IP to advertise is known ahead of time, disable address discovery.
if gossipAdvertiseAddress != nil {
opts = append(opts, libp2p.DisableIdentifyAddressDiscovery())
}

return h, err
return libp2p.New(opts...)
}

func Run(params *RunParams) func(ctx context.Context) error {
Expand Down

0 comments on commit 0548ea6

Please sign in to comment.