diff --git a/electrum/daemon.py b/electrum/daemon.py index 6fce7eeb0..caf2dc4bf 100644 --- a/electrum/daemon.py +++ b/electrum/daemon.py @@ -463,6 +463,7 @@ class Daemon(Logger): @with_wallet_lock def load_wallet(self, path, password, *, upgrade=False) -> Optional[Abstract_Wallet]: + assert password != '' path = standardize_path(path) wallet_key = self._wallet_key_from_path(path) # wizard will be launched if we return diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py index 341f36a01..4d102d0ab 100644 --- a/electrum/gui/qt/__init__.py +++ b/electrum/gui/qt/__init__.py @@ -442,8 +442,10 @@ class ElectrumGui(BaseElectrumGui, Logger): else: wallet_file = d['wallet_name'] + password = d.get('password') or None # convert '' to None + try: - wallet = self.daemon.load_wallet(wallet_file, d['password'], upgrade=True) + wallet = self.daemon.load_wallet(wallet_file, password, upgrade=True) return wallet except WalletRequiresSplit as e: wizard.run_split(wallet_file, e._split_data) @@ -454,8 +456,8 @@ class ElectrumGui(BaseElectrumGui, Logger): action = db.get_action() assert action[1] == 'accept_terms_of_use', 'only support for resuming trustedcoin split setup' k1 = load_keystore(db, 'x1') - if 'password' in d and d['password']: - xprv = k1.get_master_private_key(d['password']) + if password is not None: + xprv = k1.get_master_private_key(password) else: xprv = db.get('x1')['xprv'] if not is_xprv(xprv):