move wallet_syncing to wallet status is_syncing

This commit is contained in:
Victor Shyba 2020-03-24 21:22:51 -03:00 committed by Jack Robison
parent 1052126522
commit 460bdc4148
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
3 changed files with 7 additions and 4 deletions

View file

@ -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,

View file

@ -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):

View file

@ -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)