mmgen-xmrwallet: ensure blockchain is rescanned only once

This commit is contained in:
The MMGen Project 2021-06-28 12:45:07 +00:00
commit f258fe881e
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2

View file

@ -521,16 +521,17 @@ class MoneroWalletOps:
if ret['received_money']:
msg(' Wallet has received funds')
while True:
for i in range(2):
wallet_height = (await self.c.call('get_height'))['height']
if wallet_height >= chain_height:
break
ymsg(f' Wallet failed to sync (wallet height [{wallet_height}] < chain height [{chain_height}])')
if not uopt.rescan_blockchain:
if i or not uopt.rescan_blockchain:
break
msg(' Rescanning blockchain...')
msg_r(' Rescanning blockchain, please be patient...')
await self.c.call('rescan_blockchain')
await self.c.call('refresh')
msg('done')
t_elapsed = int(time.time() - t_start)