wallet: enable/disable_keystore: trivial clean-up
This commit is contained in:
@@ -183,7 +183,7 @@ class WalletInfoDialog(WindowModalDialog):
|
|||||||
self.window.show_message(_('Cannot disable keystore: You have active lightning channels'))
|
self.window.show_message(_('Cannot disable keystore: You have active lightning channels'))
|
||||||
return
|
return
|
||||||
|
|
||||||
msg = _('Disable keystore? This will make the keytore watching-only.')
|
msg = _('Disable keystore? This will make the keystore watching-only.')
|
||||||
if self.wallet.storage.is_encrypted_with_hw_device():
|
if self.wallet.storage.is_encrypted_with_hw_device():
|
||||||
msg += '\n\n' + _('Note that this will disable wallet file encryption, because it uses your hardware wallet device.')
|
msg += '\n\n' + _('Note that this will disable wallet file encryption, because it uses your hardware wallet device.')
|
||||||
if not self.window.question(msg):
|
if not self.window.question(msg):
|
||||||
|
|||||||
@@ -3261,6 +3261,12 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
|||||||
def save_keystore(self):
|
def save_keystore(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def enable_keystore(self, keystore: KeyStore, is_hardware_keystore: bool, password) -> None:
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
def disable_keystore(self, keystore: KeyStore) -> None:
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def has_seed(self) -> bool:
|
def has_seed(self) -> bool:
|
||||||
pass
|
pass
|
||||||
@@ -4030,14 +4036,13 @@ class Deterministic_Wallet(Abstract_Wallet):
|
|||||||
def get_txin_type(self, address=None):
|
def get_txin_type(self, address=None):
|
||||||
return self.txin_type
|
return self.txin_type
|
||||||
|
|
||||||
def enable_keystore(self, keystore, is_hardware_keystore: bool, password):
|
def enable_keystore(self, keystore: KeyStore, is_hardware_keystore: bool, password) -> None:
|
||||||
if not is_hardware_keystore and self.storage.is_encrypted_with_user_pw():
|
if not is_hardware_keystore and self.storage.is_encrypted_with_user_pw():
|
||||||
keystore.update_password(None, password)
|
keystore.update_password(None, password)
|
||||||
self.db.put('use_encryption', True)
|
self.db.put('use_encryption', True)
|
||||||
self._update_keystore(keystore)
|
self._update_keystore(keystore)
|
||||||
|
|
||||||
def disable_keystore(self, keystore):
|
def disable_keystore(self, keystore: KeyStore) -> None:
|
||||||
from .keystore import BIP32_KeyStore
|
|
||||||
assert not self.has_channels()
|
assert not self.has_channels()
|
||||||
if hasattr(keystore, 'thread') and keystore.thread:
|
if hasattr(keystore, 'thread') and keystore.thread:
|
||||||
keystore.thread.stop()
|
keystore.thread.stop()
|
||||||
|
|||||||
@@ -268,8 +268,8 @@ class KeystoreWizardTestCase(WizardTestCase):
|
|||||||
'hw_type': 'trezor',
|
'hw_type': 'trezor',
|
||||||
'master_key': 'zpub6rakEaM5ps5UiQ2yhbWiEkd6ceJfmuzegwc62G4itMz8L7rRFRqh6y8bTCScXV6NfTMUhANYQnfqfBd9dYfBRKf4LD1Yyfc8UvwY1MtNKWs',
|
'master_key': 'zpub6rakEaM5ps5UiQ2yhbWiEkd6ceJfmuzegwc62G4itMz8L7rRFRqh6y8bTCScXV6NfTMUhANYQnfqfBd9dYfBRKf4LD1Yyfc8UvwY1MtNKWs',
|
||||||
'root_fingerprint': 'b3569ff0',
|
'root_fingerprint': 'b3569ff0',
|
||||||
'label': 'test',
|
'label': 'trezor_unittests',
|
||||||
'soft_device_id': '1',
|
'soft_device_id': '088C3F260B66F60E15DE0FA5',
|
||||||
})
|
})
|
||||||
self.assertTrue(w.is_last_view(v.view, d))
|
self.assertTrue(w.is_last_view(v.view, d))
|
||||||
v = w.resolve_next(v.view, d)
|
v = w.resolve_next(v.view, d)
|
||||||
|
|||||||
Reference in New Issue
Block a user