From a67aaf1fdfa90f25bbb77cc95c92f8b7162c84f5 Mon Sep 17 00:00:00 2001 From: Philippe Jalaber Date: Fri, 10 Jun 2022 10:54:04 +0200 Subject: [PATCH] Multiaddr duplicated p2p protocol in relay reservation (#2696) --- protocols/relay/src/v2/relay.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/protocols/relay/src/v2/relay.rs b/protocols/relay/src/v2/relay.rs index 8d8bb75caa99..30ceb2bda6ff 100644 --- a/protocols/relay/src/v2/relay.rs +++ b/protocols/relay/src/v2/relay.rs @@ -757,8 +757,12 @@ impl Action { addrs: poll_parameters .external_addresses() .map(|a| { - a.addr - .with(Protocol::P2p((*poll_parameters.local_peer_id()).into())) + let p2p_proto = + Protocol::P2p(*poll_parameters.local_peer_id().as_ref()); + match a.addr.iter().last() { + Some(p) if p == p2p_proto => a.addr, + _ => a.addr.with(p2p_proto), + } }) .collect(), }),