diff --git a/electrum/json_db.py b/electrum/json_db.py index 5f11ad16d..42321d4e9 100644 --- a/electrum/json_db.py +++ b/electrum/json_db.py @@ -55,12 +55,12 @@ class TxFeesValue(NamedTuple): class JsonDB(Logger): - def __init__(self, raw, *, manual_upgrades): + def __init__(self, raw, *, manual_upgrades: bool): Logger.__init__(self) self.lock = threading.RLock() self.data = {} self._modified = False - self.manual_upgrades = manual_upgrades + self._manual_upgrades = manual_upgrades self._called_after_upgrade_tasks = False if raw: # loading existing db self.load_data(raw) @@ -142,12 +142,12 @@ class JsonDB(Logger): if not isinstance(self.data, dict): raise WalletFileException("Malformed wallet file (not dict)") - if not self.manual_upgrades and self.requires_split(): + if not self._manual_upgrades and self.requires_split(): raise WalletFileException("This wallet has multiple accounts and must be split") if not self.requires_upgrade(): self._after_upgrade_tasks() - elif not self.manual_upgrades: + elif not self._manual_upgrades: self.upgrade() def requires_split(self): diff --git a/electrum/storage.py b/electrum/storage.py index 2273abc54..044154ebb 100644 --- a/electrum/storage.py +++ b/electrum/storage.py @@ -55,11 +55,12 @@ class StorageReadWriteError(Exception): pass class WalletStorage(Logger): - def __init__(self, path, *, manual_upgrades=False): + def __init__(self, path, *, manual_upgrades: bool = False): Logger.__init__(self) self.lock = threading.RLock() self.path = standardize_path(path) self._file_exists = bool(self.path and os.path.exists(self.path)) + self._manual_upgrades = manual_upgrades DB_Class = JsonDB self.logger.info(f"wallet path {self.path}") @@ -211,7 +212,7 @@ class WalletStorage(Logger): s = None self.pubkey = ec_key.get_public_key_hex() s = s.decode('utf8') - self.db = JsonDB(s, manual_upgrades=True) + self.db = JsonDB(s, manual_upgrades=self._manual_upgrades) self.load_plugins() def encrypt_before_writing(self, plaintext: str) -> str: