fix: use same privKey when displaying addresses

This commit is contained in:
Richard Ramos 2021-10-15 08:38:55 -04:00
parent 1c991a94d8
commit a956684f48
No known key found for this signature in database
GPG Key ID: 80D4B01265FDFE8F
2 changed files with 6 additions and 1 deletions

View File

@ -88,7 +88,7 @@ func New(ctx context.Context, opts ...WakuNodeOption) (*WakuNode, error) {
}
if params.privKey != nil {
params.libP2POpts = append(params.libP2POpts, libp2p.Identity(*params.privKey))
params.libP2POpts = append(params.libP2POpts, params.Identity())
}
if params.addressFactory != nil {

View File

@ -10,6 +10,7 @@ import (
connmgr "github.com/libp2p/go-libp2p-connmgr"
"github.com/libp2p/go-libp2p-core/crypto"
pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/libp2p/go-libp2p/config"
basichost "github.com/libp2p/go-libp2p/p2p/host/basic"
"github.com/multiformats/go-multiaddr"
ma "github.com/multiformats/go-multiaddr"
@ -54,6 +55,10 @@ func (w WakuNodeParameters) MultiAddresses() []ma.Multiaddr {
return w.multiAddr
}
func (w WakuNodeParameters) Identity() config.Option {
return libp2p.Identity(*w.privKey)
}
// WithHostAddress is a WakuNodeOption that configures libp2p to listen on a list of net endpoint addresses
func WithHostAddress(hostAddr []net.Addr) WakuNodeOption {
return func(params *WakuNodeParameters) error {