Preventive exception catch.

This commit is contained in:
Florin Chirica 2020-09-30 00:59:51 +03:00 committed by Gene Hoffman
parent 13b634249a
commit 08c985ba7e
1 changed files with 16 additions and 14 deletions

View File

@ -109,20 +109,6 @@ class FullNode:
self.full_node_store = await FullNodeStore.create(self.connection)
self.sync_store = await SyncStore.create()
self.coin_store = await CoinStore.create(self.connection)
self.full_node_peers = FullNodePeers(
self.server,
self.root_path,
self.global_connections,
self.config["target_peer_count"]
- self.config["target_outbound_peer_count"],
self.config["target_outbound_peer_count"],
self.config["peer_db_path"],
self.config["introducer_peer"],
self.config["peer_connect_interval"],
self.log,
)
await self.full_node_peers.start()
self.log.info("Initializing blockchain from disk")
self.blockchain = await Blockchain.create(
self.coin_store, self.block_store, self.constants
@ -134,6 +120,22 @@ class FullNode:
self.mempool_manager = MempoolManager(self.coin_store, self.constants)
await self.mempool_manager.new_tips(await self.blockchain.get_full_tips())
self.state_changed_callback = None
try:
self.full_node_peers = FullNodePeers(
self.server,
self.root_path,
self.global_connections,
self.config["target_peer_count"]
- self.config["target_outbound_peer_count"],
self.config["target_outbound_peer_count"],
self.config["peer_db_path"],
self.config["introducer_peer"],
self.config["peer_connect_interval"],
self.log,
)
await self.full_node_peers.start()
except Exception as e:
self.log.error(f"Exception in peer discovery: {e}")
uncompact_interval = self.config["send_uncompact_interval"]
if uncompact_interval > 0:
self.broadcast_uncompact_task = asyncio.create_task(