TwJSON.Import: add blockchain rescan warning

This commit is contained in:
The MMGen Project 2022-12-01 12:32:33 +00:00
commit 2f5eeb066a
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 15 additions and 0 deletions

View file

@ -36,6 +36,16 @@ class BitcoinTwJSON(TwJSON):
few minutes.
"""
blockchain_rescan_warning = """
Balances have been updated in the new tracking wallet. However, the wallet
is unaware of the used state of any spent addresses without balances, which
creates the danger of address reuse, especially when automatic change address
selection is in effect.
To avoid this danger and restore full tracking wallet functionality, rescan
the blockchain for used addresses by running mmgen-tool rescan_blockchain.
"""
@property
async def tracking_wallet_exists(self):
return await self.twctl.rpc.check_or_create_daemon_wallet(wallet_create=False)

View file

@ -62,6 +62,8 @@ class TwJSON:
class Import(Base,metaclass=AsyncInit):
blockchain_rescan_warning = None
async def __init__(self,proto,filename,ignore_checksum=False,batch=False):
super().__init__(proto)
@ -104,6 +106,9 @@ class TwJSON:
await self.twctl.rescan_addresses(addrs)
if self.blockchain_rescan_warning:
ymsg('\n' + fmt(self.blockchain_rescan_warning.strip(),indent=' '))
async def check_and_create_wallet(self):
if await self.tracking_wallet_exists: