wallet: enable/disable_keystore: trivial clean-up
What changed, and why it matters
This is a minor code cleanup commit. It fixes a typo in a user-facing message ('keytore' to 'keystore'), adds abstract method declarations for enable/disable_keystore in the base wallet class, updates type hints, and changes test fixture values. There is no security-relevant change.
No action required; this is a non-security cleanup commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit is a trivial refactor: (1) corrects a typo in wallet_info_dialog.py; (2) declares enable_keystore/disable_keystore as NotImplementedError abstract methods in Abstract_Wallet; (3) adds type annotations and removes an unused import in Deterministic_Wallet; (4) updates test data labels and soft_device_id in test_wizard.py. No logic affecting cryptography, authentication, authorization, or asset handling is changed.
Changed components
electrum/gui/qt/wallet_info_dialog.pyelectrum/wallet.pytests/test_wizard.pyInspect captured patch +11 / −6
diff --git a/electrum/gui/qt/wallet_info_dialog.py b/electrum/gui/qt/wallet_info_dialog.py
index 9d6a26c..9ab87a5 100644
--- a/electrum/gui/qt/wallet_info_dialog.py
+++ b/electrum/gui/qt/wallet_info_dialog.py
@@ -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):
diff --git a/electrum/wallet.py b/electrum/wallet.py
index cf68667..b41a81b 100644
--- a/electrum/wallet.py
+++ b/electrum/wallet.py
@@ -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()
diff --git a/tests/test_wizard.py b/tests/test_wizard.py
index 203e37e..70dddd5 100644
--- a/tests/test_wizard.py
+++ b/tests/test_wizard.py
@@ -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)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.