1
0

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...
This commit is contained in:
ThomasV
2023-09-23 12:34:31 +02:00
parent 30038f4ace
commit 4cc3c704b2
2 changed files with 4 additions and 5 deletions

View File

@@ -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')

View File

@@ -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'))