Allow Decred wallets derived from the legacy extkey.

When importing from seed dcrwallet creates two accounts, one each on coin_id 20 and 42.

Can't see how to force slip44 upgrade to run in dcrwallet, checking for either key instead.
This commit is contained in:
tecnovert
2024-05-27 15:44:48 +02:00
parent 57bc1d5ccf
commit b077561a6f
5 changed files with 24 additions and 6 deletions

View File

@@ -1285,6 +1285,7 @@ def initialise_wallets(particl_wallet_mnemonic, with_coins, data_dir, settings,
swap_client = None
daemons = []
daemon_args = ['-noconnect', '-nodnsseed']
generated_mnemonic: bool = False
coins_failed_to_initialise = []
@@ -1359,6 +1360,7 @@ def initialise_wallets(particl_wallet_mnemonic, with_coins, data_dir, settings,
logger.info('Loading Particl mnemonic')
if particl_wallet_mnemonic is None:
particl_wallet_mnemonic = swap_client.callcoinrpc(Coins.PART, 'mnemonic', ['new'])['mnemonic']
generated_mnemonic = True
swap_client.callcoinrpc(Coins.PART, 'extkeyimportmaster', [particl_wallet_mnemonic])
# Particl wallet must be unlocked to call getWalletKey
if WALLET_ENCRYPTION_PWD != '':
@@ -1400,7 +1402,7 @@ def initialise_wallets(particl_wallet_mnemonic, with_coins, data_dir, settings,
print('WARNING - dcrwallet requires the password to be entered at the first startup when encrypted.\nPlease use basicswap-run with --startonlycoin=decred and the WALLET_ENCRYPTION_PWD environment var set for the initial sync.')
if particl_wallet_mnemonic is not None:
if particl_wallet_mnemonic:
if generated_mnemonic:
# Print directly to stdout for tests
print('IMPORTANT - Save your particl wallet recovery phrase:\n{}\n'.format(particl_wallet_mnemonic))