From 460bdc4148684eecb7db5e23f875637fc5cbaaa5 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Tue, 24 Mar 2020 21:22:51 -0300 Subject: [PATCH] move wallet_syncing to wallet status is_syncing --- lbry/extras/daemon/components.py | 1 - lbry/extras/daemon/daemon.py | 6 +++++- tests/integration/blockchain/test_wallet_commands.py | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lbry/extras/daemon/components.py b/lbry/extras/daemon/components.py index 8a08be97a..5271c1558 100644 --- a/lbry/extras/daemon/components.py +++ b/lbry/extras/daemon/components.py @@ -146,7 +146,6 @@ class WalletComponent(Component): best_hash = await self.wallet_manager.get_best_blockhash() result.update({ 'headers_synchronization_progress': progress, - 'wallet_syncing': len(self.wallet_manager.ledger._update_tasks) > 0, 'blocks': max(local_height, 0), 'blocks_behind': max(remote_height - local_height, 0), 'best_blockhash': best_hash, diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index 28c7022e7..4196f9491 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -1326,7 +1326,11 @@ class Daemon(metaclass=JSONRPCServerType): Dictionary of wallet status information. """ wallet = self.wallet_manager.get_wallet_or_default(wallet_id) - return {'is_encrypted': wallet.is_encrypted, 'is_locked': wallet.is_locked} + return { + 'is_encrypted': wallet.is_encrypted, + 'is_syncing': len(self.ledger._update_tasks) > 0, + 'is_locked': wallet.is_locked + } @requires(WALLET_COMPONENT) def jsonrpc_wallet_unlock(self, password, wallet_id=None): diff --git a/tests/integration/blockchain/test_wallet_commands.py b/tests/integration/blockchain/test_wallet_commands.py index 6bb98c324..61eef4f44 100644 --- a/tests/integration/blockchain/test_wallet_commands.py +++ b/tests/integration/blockchain/test_wallet_commands.py @@ -25,8 +25,8 @@ class WalletCommands(CommandTestCase): sendtxid = await self.blockchain.send_to_address(address, 1) async def eventually_will_sync(): - while not (await self.daemon.jsonrpc_status())['wallet']['wallet_syncing']: - pass + while not self.daemon.jsonrpc_wallet_status()['is_syncing']: + await asyncio.sleep(0) check_sync = asyncio.create_task(eventually_will_sync()) await self.confirm_tx(sendtxid, self.ledger) await asyncio.wait_for(check_sync, timeout=10)