From 4cc3c704b23401e18e4524533ee8506766f5e9cc Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sat, 23 Sep 2023 12:34:31 +0200 Subject: [PATCH] QML: Check passwords with WalletDB instances that have no storage, to avoid unwanted side effects. In qedaemon, call load_wallet with upgrade=True when loading a wallet. Apparently, this was not done before; db upgrades were performed as a side-effect of password verification... --- electrum/gui/qml/qedaemon.py | 2 +- electrum/gui/qml/qewalletdb.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/electrum/gui/qml/qedaemon.py b/electrum/gui/qml/qedaemon.py index d6971635d..a6cc25bf5 100644 --- a/electrum/gui/qml/qedaemon.py +++ b/electrum/gui/qml/qedaemon.py @@ -203,7 +203,7 @@ class QEDaemon(AuthMixin, QObject): try: local_password = password # need this in local scope - wallet = self.daemon.load_wallet(self._path, local_password) + wallet = self.daemon.load_wallet(self._path, local_password, upgrade=True) if wallet is None: self._logger.info('could not open wallet') diff --git a/electrum/gui/qml/qewalletdb.py b/electrum/gui/qml/qewalletdb.py index b46850138..5bd705666 100644 --- a/electrum/gui/qml/qewalletdb.py +++ b/electrum/gui/qml/qewalletdb.py @@ -43,7 +43,6 @@ class QEWalletDB(QObject): self._validPassword = True self._storage = None - self._db = None self._ready = False @@ -143,7 +142,7 @@ class QEWalletDB(QObject): else: # storage not encrypted; but it might still have a keystore pw # FIXME hack... load both db and full wallet, just to tell if it has keystore pw. try: - db = WalletDB(self._storage.read(), storage=self._storage, upgrade=True) + db = WalletDB(self._storage.read(), storage=None, upgrade=True) except WalletRequiresSplit as e: raise WalletFileException(_('This wallet requires to be split. This is currently not supported on mobile')) wallet = Wallet(db, config=self._config) @@ -165,11 +164,11 @@ class QEWalletDB(QObject): """can raise WalletFileException""" # needs storage accessible try: - self._db = WalletDB(self._storage.read(), storage=self._storage, upgrade=True) + db = WalletDB(self._storage.read(), storage=None, upgrade=True) except WalletRequiresSplit as e: self._logger.warning('wallet requires split') raise WalletFileException(_('This wallet needs splitting. This is not supported on mobile')) - if self._db.get_action(): + if db.get_action(): self._logger.warning('action pending. QML version doesn\'t support continuation of wizard') raise WalletFileException(_('This wallet has an action pending. This is currently not supported on mobile'))