updating to proper multiaddr and changing to p2p

This commit is contained in:
Robert Zajac
2018-12-28 01:56:00 -05:00
parent f6c6ec2213
commit 4c0cd8730f
6 changed files with 10 additions and 10 deletions

View File

@ -19,15 +19,15 @@ def info_from_p2p_addr(addr):
if not parts:
raise InvalidAddrError()
ipfspart = parts[-1]
if ipfspart.protocols()[0].code != multiaddr.protocols.P_IPFS:
p2ppart = parts[-1]
if p2ppart.protocols()[0].code != multiaddr.protocols.P_P2P:
raise InvalidAddrError()
# make sure the /ipfs value parses as a peer.ID
peer_id_str = ipfspart.value_for_protocol(multiaddr.protocols.P_IPFS)
# make sure the /p2p value parses as a peer.ID
peer_id_str = p2ppart.value_for_protocol(multiaddr.protocols.P_P2P)
peer_id = id_b58_decode(peer_id_str)
# we might have received just an / ipfs part, which means there's no addr.
# we might have received just an / p2p part, which means there's no addr.
if len(parts) > 1:
addr = multiaddr.util.join(parts[:-1])