diff --git a/protocols/relay/CHANGELOG.md b/protocols/relay/CHANGELOG.md index 46d3b2ffcee..8df4de38fac 100644 --- a/protocols/relay/CHANGELOG.md +++ b/protocols/relay/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.9.2 - unreleased + +- Do not duplicate the p2p/xxx component with the relay PeerId when a client requests a reservation. See [PR 2701]. + +[PR 2701]: https://github.com/libp2p/rust-libp2p/pull/2701/ + # 0.9.1 - Respond to at most one incoming reservation request. Deny <= 8 incoming diff --git a/protocols/relay/Cargo.toml b/protocols/relay/Cargo.toml index 7fe66e547d1..e5470672fca 100644 --- a/protocols/relay/Cargo.toml +++ b/protocols/relay/Cargo.toml @@ -3,7 +3,7 @@ name = "libp2p-relay" edition = "2021" rust-version = "1.56.1" description = "Communications relaying for libp2p" -version = "0.9.1" +version = "0.9.2" authors = ["Parity Technologies ", "Max Inden "] license = "MIT" repository = "https://github.com/libp2p/rust-libp2p" diff --git a/protocols/relay/src/v2/relay.rs b/protocols/relay/src/v2/relay.rs index 30ceb2bda6f..ed5fe6ca326 100644 --- a/protocols/relay/src/v2/relay.rs +++ b/protocols/relay/src/v2/relay.rs @@ -756,13 +756,13 @@ impl Action { inbound_reservation_req, addrs: poll_parameters .external_addresses() - .map(|a| { - 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), - } + .map(|a| a.addr) + // Add local peer ID in case it isn't present yet. + .filter_map(|a| match a.iter().last()? { + Protocol::P2p(_) => Some(a), + _ => Some( + a.with(Protocol::P2p(*poll_parameters.local_peer_id().as_ref())), + ), }) .collect(), }),