1
0

qml wizard: fix restoring from old mpk (watchonly for "old" seeds)

fixes https://github.com/spesmilo/electrum/issues/8356
This commit is contained in:
SomberNight
2023-04-27 09:34:23 +00:00
parent 87909485c5
commit f5f177f7e8
3 changed files with 27 additions and 25 deletions

View File

@@ -381,15 +381,18 @@ class NewWalletWizard(AbstractWizard):
raise Exception('unsupported/unknown seed_type %s' % data['seed_type'])
elif data['keystore_type'] == 'masterkey':
k = keystore.from_master_key(data['master_key'])
has_xpub = isinstance(k, keystore.Xpub)
assert has_xpub
t1 = xpub_type(k.xpub)
if data['wallet_type'] == 'multisig':
if t1 not in ['standard', 'p2wsh', 'p2wsh-p2sh']:
raise Exception('wrong key type %s' % t1)
if isinstance(k, keystore.Xpub): # has xpub
t1 = xpub_type(k.xpub)
if data['wallet_type'] == 'multisig':
if t1 not in ['standard', 'p2wsh', 'p2wsh-p2sh']:
raise Exception('wrong key type %s' % t1)
else:
if t1 not in ['standard', 'p2wpkh', 'p2wpkh-p2sh']:
raise Exception('wrong key type %s' % t1)
elif isinstance(k, keystore.Old_KeyStore):
pass
else:
if t1 not in ['standard', 'p2wpkh', 'p2wpkh-p2sh']:
raise Exception('wrong key type %s' % t1)
raise Exception(f"unexpected keystore type: {type(keystore)}")
else:
raise Exception('unsupported/unknown keystore_type %s' % data['keystore_type'])