From 4450e6bba07ebcda9f571ddc46c6d1dad1fcaff1 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Tue, 31 Aug 2021 15:17:56 -0400 Subject: [PATCH] adds DialbyPeerID --- waku/v2/node/wakunode2.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/waku/v2/node/wakunode2.go b/waku/v2/node/wakunode2.go index 31e61468..9a9f8b6c 100644 --- a/waku/v2/node/wakunode2.go +++ b/waku/v2/node/wakunode2.go @@ -697,7 +697,6 @@ func (w *WakuNode) DialPeer(address string) error { return err } - // Extract the peer ID from the multiaddr. info, err := peer.AddrInfoFromP2pAddr(p) if err != nil { return err @@ -706,6 +705,11 @@ func (w *WakuNode) DialPeer(address string) error { return w.host.Connect(w.ctx, *info) } +func (w *WakuNode) DialPeerByID(peerID peer.ID) error { + info := w.host.Peerstore().PeerInfo(peerID) + return w.host.Connect(w.ctx, info) +} + func (w *WakuNode) ClosePeerByAddress(address string) error { p, err := ma.NewMultiaddr(address) if err != nil {