1
0

wallet: enable/disable_keystore: trivial clean-up

This commit is contained in:
SomberNight
2025-08-14 16:16:31 +00:00
parent 5bfd5a858f
commit e3d1c6aefd
3 changed files with 11 additions and 6 deletions

View File

@@ -183,7 +183,7 @@ class WalletInfoDialog(WindowModalDialog):
self.window.show_message(_('Cannot disable keystore: You have active lightning channels'))
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():
msg += '\n\n' + _('Note that this will disable wallet file encryption, because it uses your hardware wallet device.')
if not self.window.question(msg):

View File

@@ -3261,6 +3261,12 @@ class Abstract_Wallet(ABC, Logger, EventListener):
def save_keystore(self):
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
def has_seed(self) -> bool:
pass
@@ -4030,14 +4036,13 @@ class Deterministic_Wallet(Abstract_Wallet):
def get_txin_type(self, address=None):
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():
keystore.update_password(None, password)
self.db.put('use_encryption', True)
self._update_keystore(keystore)
def disable_keystore(self, keystore):
from .keystore import BIP32_KeyStore
def disable_keystore(self, keystore: KeyStore) -> None:
assert not self.has_channels()
if hasattr(keystore, 'thread') and keystore.thread:
keystore.thread.stop()

View File

@@ -268,8 +268,8 @@ class KeystoreWizardTestCase(WizardTestCase):
'hw_type': 'trezor',
'master_key': 'zpub6rakEaM5ps5UiQ2yhbWiEkd6ceJfmuzegwc62G4itMz8L7rRFRqh6y8bTCScXV6NfTMUhANYQnfqfBd9dYfBRKf4LD1Yyfc8UvwY1MtNKWs',
'root_fingerprint': 'b3569ff0',
'label': 'test',
'soft_device_id': '1',
'label': 'trezor_unittests',
'soft_device_id': '088C3F260B66F60E15DE0FA5',
})
self.assertTrue(w.is_last_view(v.view, d))
v = w.resolve_next(v.view, d)