wizard: fix assumption 'keystore_type' is present in wizard_data, fix unexpected keystore type msg
This commit is contained in:
@@ -364,4 +364,6 @@ class OutdatedHwFirmwareException(UserFacingException):
|
|||||||
|
|
||||||
|
|
||||||
class OperationCancelled(UserFacingException):
|
class OperationCancelled(UserFacingException):
|
||||||
|
"""Emitted when an operation is cancelled by user on a HW device
|
||||||
|
"""
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -560,7 +560,7 @@ class NewWalletWizard(AbstractWizard):
|
|||||||
elif isinstance(k, keystore.Old_KeyStore):
|
elif isinstance(k, keystore.Old_KeyStore):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise Exception(f"unexpected keystore type: {type(keystore)}")
|
raise Exception(f"unexpected keystore type: {type(k)}")
|
||||||
elif data['keystore_type'] == 'hardware': # TODO: prelim impl
|
elif data['keystore_type'] == 'hardware': # TODO: prelim impl
|
||||||
k = self.hw_keystore(data)
|
k = self.hw_keystore(data)
|
||||||
if isinstance(k, keystore.Xpub): # has xpub
|
if isinstance(k, keystore.Xpub): # has xpub
|
||||||
@@ -571,10 +571,8 @@ class NewWalletWizard(AbstractWizard):
|
|||||||
else:
|
else:
|
||||||
if t1 not in ['standard', 'p2wpkh', 'p2wpkh-p2sh']:
|
if t1 not in ['standard', 'p2wpkh', 'p2wpkh-p2sh']:
|
||||||
raise Exception('wrong key type %s' % t1)
|
raise Exception('wrong key type %s' % t1)
|
||||||
# elif isinstance(k, keystore.Old_KeyStore):
|
|
||||||
# pass
|
|
||||||
else:
|
else:
|
||||||
raise Exception(f"unexpected keystore type: {type(keystore)}")
|
raise Exception(f"unexpected keystore type: {type(k)}")
|
||||||
else:
|
else:
|
||||||
raise Exception('unsupported/unknown keystore_type %s' % data['keystore_type'])
|
raise Exception('unsupported/unknown keystore_type %s' % data['keystore_type'])
|
||||||
|
|
||||||
@@ -582,7 +580,7 @@ class NewWalletWizard(AbstractWizard):
|
|||||||
if k and k.may_have_password():
|
if k and k.may_have_password():
|
||||||
k.update_password(None, data['password'])
|
k.update_password(None, data['password'])
|
||||||
enc_version = StorageEncryptionVersion.USER_PASSWORD
|
enc_version = StorageEncryptionVersion.USER_PASSWORD
|
||||||
if data['keystore_type'] == 'hardware':
|
if 'keystore_type' in data and data['keystore_type'] == 'hardware':
|
||||||
enc_version = StorageEncryptionVersion.XPUB_PASSWORD
|
enc_version = StorageEncryptionVersion.XPUB_PASSWORD
|
||||||
storage.set_password(data['password'], enc_version=enc_version)
|
storage.set_password(data['password'], enc_version=enc_version)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user