Convert from base58/pubkey/privkey to class method

This commit is contained in:
NIC619
2019-07-31 19:31:58 +08:00
parent 80481252ca
commit b928bdb356
7 changed files with 46 additions and 19 deletions

View File

@ -2,7 +2,7 @@ from typing import List
import multiaddr
from .id import ID, id_b58_decode
from .id import ID
from .peerdata import PeerData
@ -39,7 +39,7 @@ def info_from_p2p_addr(addr: multiaddr.Multiaddr) -> PeerInfo:
# make sure the /p2p value parses as a peer.ID
peer_id_str: str = p2p_part.value_for_protocol(multiaddr.protocols.P_P2P)
peer_id: ID = id_b58_decode(peer_id_str)
peer_id: ID = ID.from_base58(peer_id_str)
# we might have received just an / p2p part, which means there's no addr.
if len(parts) > 1: