From f380909db3a9c681d610f55ed36d4d53d9b638db 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/protocols/relay/src/v2/relay.rs b/protocols/relay/src/v2/relay.rs index 8d8bb75caa99..e08b84fda613 100644 --- a/protocols/relay/src/v2/relay.rs +++ b/protocols/relay/src/v2/relay.rs @@ -757,8 +757,11 @@ 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(), }),