libp2p/py-libp2p

network/swarm.py and transport/tcp is not smart enough to detect that peerstore multiaddress is not reachable

ShadowJonathan opened this issue · 0 comments

What was wrong?

In py-libp2p, as of right now, there only exists one network implementation, and one
transport implementation: Swarm and TCP.

When the swarm would encounter a multiaddress in it's peerstore with values like udp/9090 or tcp/9090/quic, it would not detect those, and instead fail with multiaddr.exceptions.ProtocolLookupError over here.

How can it be fixed?

Add a generic function under transport/ which iterates over all registered ITransport classes, and add a function to ITransport that accepts one Multiaddr, and returns True when that multiaddress is supported by that transport.

Make Swarm try to acquire that ITransport upon trying a Multiaddr, and fail with SwarmException when there is no ITransport that supports that MultiAddr.