hosts track their public key

This commit is contained in:
Alex Stokes
2019-10-28 18:44:55 +09:00
parent 11db313b17
commit 32c55bcaf2
4 changed files with 16 additions and 4 deletions

View File

@ -46,9 +46,11 @@ class BasicHost(IHost):
def __init__(
self,
public_key: PublicKey,
network: INetwork,
default_protocols: "OrderedDict[TProtocol, StreamHandlerFn]" = None,
) -> None:
self._public_key = public_key
self._network = network
self._network.set_stream_handler(self._swarm_stream_handler)
self.peerstore = self._network.peerstore
@ -63,6 +65,9 @@ class BasicHost(IHost):
"""
return self._network.get_peer_id()
def get_public_key(self) -> PublicKey:
return self._public_key
def get_network(self) -> INetwork:
"""
:return: network instance of host