fix: decode peerID string into peer.ID

This commit is contained in:
Richard Ramos 2023-01-14 09:49:20 -04:00 committed by RichΛrd
parent ed9ca8392c
commit ebacdfc760
1 changed files with 10 additions and 2 deletions

View File

@ -1484,11 +1484,19 @@ func (w *Waku) DialPeer(address string) error {
func (w *Waku) DialPeerByID(peerID string) error {
ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
defer cancel()
return w.node.DialPeerByID(ctx, peer.ID(peerID))
pid, err := peer.Decode(peerID)
if err != nil {
return err
}
return w.node.DialPeerByID(ctx, pid)
}
func (w *Waku) DropPeer(peerID string) error {
return w.node.ClosePeerById(peer.ID(peerID))
pid, err := peer.Decode(peerID)
if err != nil {
return err
}
return w.node.ClosePeerById(pid)
}
func (w *Waku) ProcessingP2PMessages() bool {