If you try and dial an address that is relayed, e.g. /ip6/2a03:b0c0:3:d0::f5b:2001/tcp/4001/p2p/12D3KooWAYhKPvH8JrBT7oTiY69LY2QksfvPH2sY8ECvR1KD9ZTo/p2p-circuit/p2p/12D3KooWHci62Skj6sC6c2ASXARBnBMmUuM7kuHqtgi5mVQdJ6Gf
Then you get an error trying to set the peerid, because there are two p2p elements in relayed addresses. We want to append in the p2p-circuit case.
java.lang.IllegalArgumentException: Value (12D3KooWHci62Skj6sC6c2ASXARBnBMmUuM7kuHqtgi5mVQdJ6Gf) for P2P doesn't match existing value in /ip6/2a03:b0c0:3:d0::f5b:2001/tcp/4001/p2p/12D3KooWAYhKPvH8JrBT7oTiY69LY2QksfvPH2sY8ECvR1KD9ZTo/p2p-circuit
at io.libp2p.core.multiformats.Multiaddr.withComponentImpl(Multiaddr.kt:68)
at io.libp2p.core.multiformats.Multiaddr.withComponent(Multiaddr.kt:78)
at io.libp2p.core.multiformats.Multiaddr.withP2P(Multiaddr.kt:57)
at io.libp2p.network.NetworkImpl.connect(NetworkImpl.kt:72)
at io.libp2p.core.Network.connect(Network.kt:75)
at io.libp2p.host.HostImpl.newStream(HostImpl.kt:94)
at io.libp2p.core.multistream.ProtocolBinding.dial(ProtocolBinding.kt:37)
If you try and dial an address that is relayed, e.g. /ip6/2a03:b0c0:3:d0::f5b:2001/tcp/4001/p2p/12D3KooWAYhKPvH8JrBT7oTiY69LY2QksfvPH2sY8ECvR1KD9ZTo/p2p-circuit/p2p/12D3KooWHci62Skj6sC6c2ASXARBnBMmUuM7kuHqtgi5mVQdJ6Gf
Then you get an error trying to set the peerid, because there are two p2p elements in relayed addresses. We want to append in the p2p-circuit case.
java.lang.IllegalArgumentException: Value (12D3KooWHci62Skj6sC6c2ASXARBnBMmUuM7kuHqtgi5mVQdJ6Gf) for P2P doesn't match existing value in /ip6/2a03:b0c0:3:d0::f5b:2001/tcp/4001/p2p/12D3KooWAYhKPvH8JrBT7oTiY69LY2QksfvPH2sY8ECvR1KD9ZTo/p2p-circuit at io.libp2p.core.multiformats.Multiaddr.withComponentImpl(Multiaddr.kt:68) at io.libp2p.core.multiformats.Multiaddr.withComponent(Multiaddr.kt:78) at io.libp2p.core.multiformats.Multiaddr.withP2P(Multiaddr.kt:57) at io.libp2p.network.NetworkImpl.connect(NetworkImpl.kt:72) at io.libp2p.core.Network.connect(Network.kt:75) at io.libp2p.host.HostImpl.newStream(HostImpl.kt:94) at io.libp2p.core.multistream.ProtocolBinding.dial(ProtocolBinding.kt:37)