Skip to content

Commit

Permalink
routedhost: fix decoding of relay peer ID (#1644)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann authored Jul 7, 2022
1 parent 66cd76d commit c5c75c0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions p2p/host/routed/routed.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ func (rh *RoutedHost) Connect(ctx context.Context, pi peer.AddrInfo) error {

// Issue 448: if our address set includes routed specific relay addrs,
// we need to make sure the relay's addr itself is in the peerstore or else
// we wont be able to dial it.
// we won't be able to dial it.
for _, addr := range addrs {
_, err := addr.ValueForProtocol(ma.P_CIRCUIT)
if err != nil {
if _, err := addr.ValueForProtocol(ma.P_CIRCUIT); err != nil {
// not a relay address
continue
}
Expand All @@ -83,8 +82,7 @@ func (rh *RoutedHost) Connect(ctx context.Context, pi peer.AddrInfo) error {
}

relay, _ := addr.ValueForProtocol(ma.P_P2P)

relayID, err := peer.IDFromString(relay)
relayID, err := peer.Decode(relay)
if err != nil {
log.Debugf("failed to parse relay ID in address %s: %s", relay, err)
continue
Expand Down

0 comments on commit c5c75c0

Please sign in to comment.