updated to not require peerstore

This commit is contained in:
Alex Haynes 2018-10-21 14:48:53 -04:00
parent f51f975533
commit 08b37ee7cd
2 changed files with 5 additions and 6 deletions

View File

@ -3,13 +3,11 @@ import asyncio
class Stream(IStream): class Stream(IStream):
def __init__(self, peer_id): def __init__(self, peer_id, maddr):
self.peer_id = peer_id self.peer_id = peer_id
peer_store = context.peer_store ip = maddr.get_protocol_value("ip4")
peer_addr = peer_store.get(peer_id) port = maddr.get_protocol_value("tcp")
ip = peer_addr.get_protocol("ip4")
port = peer_addr.get_protocol("tcp")
# look up peer_id -> multiaddr in peer store # look up peer_id -> multiaddr in peer store
# parse multiaddr and set_protocol based on it # parse multiaddr and set_protocol based on it

View File

@ -2,8 +2,9 @@ from abc import ABC, abstractmethod
class IStream(ABC): class IStream(ABC):
def __init__(self, peer_id): def __init__(self, peer_id, maddr):
self.peer_id = peer_id self.peer_id = peer_id
self.maddr = maddr
@abstractmethod @abstractmethod
def protocol(self): def protocol(self):