(trivial) move StorageEncryptionVersion and StorageReadWriteError to stored_dict.py
What changed, and why it matters
This commit is a simple code cleanup: it moves two definitions (a storage encryption version enum and a read/write error exception) from one file to another and updates the import statements in the files that use them. There is no functional change, no bug fix, and no security relevance.
No action needed; this is a non-functional refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change relocates StorageEncryptionVersion (an IntEnum) and StorageReadWriteError (an Exception subclass) from electrum/storage.py to electrum/stored_dict.py. It then updates import statements in electrum/gui/qt/main_window.py and electrum/wallet.py to import from the new location. The values and behavior of the moved symbols are unchanged. No logic, cryptography, or wallet behavior is modified.
Changed components
electrum/storage.pyelectrum/stored_dict.pyelectrum/gui/qt/main_window.pyelectrum/wallet.pyInspect captured patch +11 / −9
diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
index e5a82b3..81b5ca9 100644
--- a/electrum/gui/qt/main_window.py
+++ b/electrum/gui/qt/main_window.py
@@ -1922,7 +1922,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
self.password_button.setVisible(self.wallet.may_have_password())
def change_password_dialog(self):
- from electrum.storage import StorageEncryptionVersion
+ from electrum.stored_dict import StorageEncryptionVersion
if StorageEncryptionVersion.XPUB_PASSWORD in self.wallet.get_available_storage_encryption_versions():
from .password_dialog import ChangePasswordDialogForHW
d = ChangePasswordDialogForHW(self, self.wallet)
diff --git a/electrum/storage.py b/electrum/storage.py
index 11ea8fe..6accb9c 100644
--- a/electrum/storage.py
+++ b/electrum/storage.py
@@ -28,7 +28,6 @@ import stat
import hashlib
import base64
import zlib
-from enum import IntEnum
from typing import Optional
import electrum_ecc as ecc
@@ -37,7 +36,6 @@ from . import crypto
from .util import (profiler, InvalidPassword, WalletFileException, bfh, standardize_path,
test_read_write_permissions, os_chmod)
-from .wallet_db import WalletDB
from .logging import Logger
@@ -47,13 +45,9 @@ def get_derivation_used_for_hw_device_encryption():
"/1112098098'") # ascii 'BIE2' as decimal
-class StorageEncryptionVersion(IntEnum):
- PLAINTEXT = 0
- USER_PASSWORD = 1
- XPUB_PASSWORD = 2
+from .stored_dict import StorageEncryptionVersion, StorageReadWriteError
-class StorageReadWriteError(Exception): pass
class StorageOnDiskUnexpectedlyChanged(Exception): pass
diff --git a/electrum/stored_dict.py b/electrum/stored_dict.py
index bbf0b95..3879126 100644
--- a/electrum/stored_dict.py
+++ b/electrum/stored_dict.py
@@ -25,6 +25,7 @@
import threading
import json
+from enum import IntEnum
from collections import defaultdict
from typing import TYPE_CHECKING, Optional, Sequence, List, Union, Any
@@ -34,6 +35,12 @@ if TYPE_CHECKING:
from .storage import WalletStorage
+class StorageReadWriteError(Exception): pass
+
+class StorageEncryptionVersion(IntEnum):
+ PLAINTEXT = 0
+ USER_PASSWORD = 1
+ XPUB_PASSWORD = 2
def locked(func):
diff --git a/electrum/wallet.py b/electrum/wallet.py
index 0de4221..70573de 100644
--- a/electrum/wallet.py
+++ b/electrum/wallet.py
@@ -63,7 +63,8 @@ from .keystore import (
)
from .simple_config import SimpleConfig
from .fee_policy import FeePolicy, FixedFeePolicy, FEE_RATIO_HIGH_WARNING, FEERATE_WARNING_HIGH_FEE
-from .storage import StorageEncryptionVersion, WalletStorage
+from .stored_dict import StorageEncryptionVersion
+from .storage import WalletStorage
from .wallet_db import WalletDB
from .transaction import (
Transaction, TxInput, TxOutput, PartialTransaction, PartialTxInput, PartialTxOutput, TxOutpoint, Sighash
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.