prepare: Add message when wallet initialisation fails.

2024-05-20_merge
tecnovert 10 months ago
parent f091d17560
commit 091e8da5e2
No known key found for this signature in database
GPG Key ID: 8ED6D8750C4E3F93
  1. 15
      bin/basicswap_prepare.py

@ -1182,6 +1182,8 @@ def initialise_wallets(particl_wallet_mnemonic, with_coins, data_dir, settings,
daemons = [] daemons = []
daemon_args = ['-noconnect', '-nodnsseed'] daemon_args = ['-noconnect', '-nodnsseed']
coins_failed_to_initialise = []
with open(os.path.join(data_dir, 'basicswap.log'), 'a') as fp: with open(os.path.join(data_dir, 'basicswap.log'), 'a') as fp:
try: try:
swap_client = BasicSwap(fp, data_dir, settings, chain, transient_instance=True) swap_client = BasicSwap(fp, data_dir, settings, chain, transient_instance=True)
@ -1248,7 +1250,10 @@ def initialise_wallets(particl_wallet_mnemonic, with_coins, data_dir, settings,
if c in (Coins.PART, ): if c in (Coins.PART, ):
continue continue
swap_client.waitForDaemonRPC(c) swap_client.waitForDaemonRPC(c)
swap_client.initialiseWallet(c) try:
swap_client.initialiseWallet(c, raise_errors=True)
except Exception as e:
coins_failed_to_initialise.append((c, e))
if WALLET_ENCRYPTION_PWD != '' and c not in coins_to_create_wallets_for: if WALLET_ENCRYPTION_PWD != '' and c not in coins_to_create_wallets_for:
try: try:
swap_client.ci(c).changeWalletPassword('', WALLET_ENCRYPTION_PWD) swap_client.ci(c).changeWalletPassword('', WALLET_ENCRYPTION_PWD)
@ -1262,6 +1267,14 @@ def initialise_wallets(particl_wallet_mnemonic, with_coins, data_dir, settings,
for d in daemons: for d in daemons:
finalise_daemon(d) finalise_daemon(d)
print('')
for pair in coins_failed_to_initialise:
c, _ = pair
if c in (Coins.PIVX, ):
print(f'NOTE - Unable to initialise wallet for {getCoinName(c)}. To complete setup click \'Reseed Wallet\' from the ui page once chain is synced.')
else:
print(f'WARNING - Failed to initialise wallet for {getCoinName(c)}')
if particl_wallet_mnemonic is not None: if particl_wallet_mnemonic is not None:
if particl_wallet_mnemonic: if particl_wallet_mnemonic:
# Print directly to stdout for tests # Print directly to stdout for tests

Loading…
Cancel
Save