mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
hosts track their public key
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user