Store our pubkey/privkey info during

`initialize_default_swarm`
This commit is contained in:
NIC619
2019-11-25 16:55:55 +08:00
parent 144d93a023
commit a63f00d8f8
3 changed files with 9 additions and 9 deletions

View File

@ -105,6 +105,10 @@ def initialize_default_swarm(
)
peerstore = peerstore_opt or PeerStore()
# Store our key pair in peerstore
peerstore.add_pubkey(id_opt, key_pair.public_key)
peerstore.add_privkey(id_opt, key_pair.private_key)
# TODO: Initialize discovery if not presented
return Swarm(id_opt, peerstore, upgrader, transport)
@ -151,9 +155,9 @@ async def new_node(
# TODO routing unimplemented
host: IHost # If not explicitly typed, MyPy raises error
if disc_opt:
host = RoutedHost(key_pair.public_key, swarm_opt, disc_opt)
host = RoutedHost(swarm_opt, disc_opt)
else:
host = BasicHost(key_pair.public_key, swarm_opt)
host = BasicHost(swarm_opt)
# Kick off cleanup job
asyncio.ensure_future(cleanup_done_tasks())