updated to not require peerstore
This commit is contained in:
parent
f51f975533
commit
08b37ee7cd
|
@ -3,13 +3,11 @@ import asyncio
|
|||
|
||||
class Stream(IStream):
|
||||
|
||||
def __init__(self, peer_id):
|
||||
def __init__(self, peer_id, maddr):
|
||||
self.peer_id = peer_id
|
||||
|
||||
peer_store = context.peer_store
|
||||
peer_addr = peer_store.get(peer_id)
|
||||
ip = peer_addr.get_protocol("ip4")
|
||||
port = peer_addr.get_protocol("tcp")
|
||||
ip = maddr.get_protocol_value("ip4")
|
||||
port = maddr.get_protocol_value("tcp")
|
||||
|
||||
# look up peer_id -> multiaddr in peer store
|
||||
# parse multiaddr and set_protocol based on it
|
||||
|
|
|
@ -2,8 +2,9 @@ from abc import ABC, abstractmethod
|
|||
|
||||
class IStream(ABC):
|
||||
|
||||
def __init__(self, peer_id):
|
||||
def __init__(self, peer_id, maddr):
|
||||
self.peer_id = peer_id
|
||||
self.maddr = maddr
|
||||
|
||||
@abstractmethod
|
||||
def protocol(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user