diff --git a/lbry/wallet/ledger.py b/lbry/wallet/ledger.py index 6e9607b58..27a0ed992 100644 --- a/lbry/wallet/ledger.py +++ b/lbry/wallet/ledger.py @@ -316,11 +316,12 @@ class Ledger(metaclass=LedgerRegistry): self.db.open(), self.headers.open() ]) - first_connection = self.network.on_connected.first - asyncio.ensure_future(self.network.start()) - await first_connection + fully_synced = self.on_ready.first + asyncio.create_task(self.network.start()) + await self.network.on_connected.first async with self._header_processing_lock: await self._update_tasks.add(self.initial_headers_sync()) + await fully_synced await asyncio.gather(*(a.maybe_migrate_certificates() for a in self.accounts)) await asyncio.gather(*(a.save_max_gap() for a in self.accounts)) if len(self.accounts) > 10: @@ -328,12 +329,9 @@ class Ledger(metaclass=LedgerRegistry): else: await self._report_state() self.on_transaction.listen(self._reset_balance_cache) - await self.on_ready.first async def join_network(self, *_): log.info("Subscribing and updating accounts.") - async with self._header_processing_lock: - await self._update_tasks.add(self.initial_headers_sync()) await self._update_tasks.add(self.subscribe_accounts()) await self._update_tasks.done.wait() self._on_ready_controller.add(True) diff --git a/tests/integration/blockchain/test_network.py b/tests/integration/blockchain/test_network.py index f2222d560..eacd0d0e6 100644 --- a/tests/integration/blockchain/test_network.py +++ b/tests/integration/blockchain/test_network.py @@ -1,4 +1,3 @@ -import logging import asyncio import lbry diff --git a/tests/integration/blockchain/test_wallet_server_sessions.py b/tests/integration/blockchain/test_wallet_server_sessions.py index 355f98762..059da8e65 100644 --- a/tests/integration/blockchain/test_wallet_server_sessions.py +++ b/tests/integration/blockchain/test_wallet_server_sessions.py @@ -45,14 +45,6 @@ class TestSessions(IntegrationTestCase): await self.ledger.network.broadcast('13370042004200') -class TestSegwitServer(IntegrationTestCase): - LEDGER = lbry.wallet - ENABLE_SEGWIT = True - - async def test_at_least_it_starts(self): - await asyncio.wait_for(self.ledger.network.get_headers(0, 1), 1.0) - - class TestUsagePayment(CommandTestCase): async def test_single_server_payment(self): wallet_pay_service = self.daemon.component_manager.get_component('wallet_server_payments')