Fix password passed to daemon.load_wallet
The password should not be an empty string.
Traceback (most recent call last):
File "/opt/electrum/electrum/gui/qt/__init__.py", line 377, in start_new_window
wallet = self._start_wizard_to_select_or_create_wallet(path)
File "/opt/electrum/electrum/gui/qt/__init__.py", line 446, in _start_wizard_to_select_or_create_wallet
wallet = self.daemon.load_wallet(wallet_file, d['password'], upgrade=True)
File "/opt/electrum/electrum/daemon.py", line 461, in func_wrapper
return func(self, *args, **kwargs)
File "/opt/electrum/electrum/daemon.py", line 474, in load_wallet
wallet.unlock(password)
File "/opt/electrum/electrum/wallet.py", line 3418, in unlock
self.check_password(password)
File "/opt/electrum/electrum/wallet.py", line 3069, in check_password
raise InvalidPassword("password given but wallet has no password")
electrum.util.InvalidPassword: password given but wallet has no password
This commit is contained in:
@@ -463,6 +463,7 @@ class Daemon(Logger):
|
|||||||
|
|
||||||
@with_wallet_lock
|
@with_wallet_lock
|
||||||
def load_wallet(self, path, password, *, upgrade=False) -> Optional[Abstract_Wallet]:
|
def load_wallet(self, path, password, *, upgrade=False) -> Optional[Abstract_Wallet]:
|
||||||
|
assert password != ''
|
||||||
path = standardize_path(path)
|
path = standardize_path(path)
|
||||||
wallet_key = self._wallet_key_from_path(path)
|
wallet_key = self._wallet_key_from_path(path)
|
||||||
# wizard will be launched if we return
|
# wizard will be launched if we return
|
||||||
|
|||||||
@@ -442,8 +442,10 @@ class ElectrumGui(BaseElectrumGui, Logger):
|
|||||||
else:
|
else:
|
||||||
wallet_file = d['wallet_name']
|
wallet_file = d['wallet_name']
|
||||||
|
|
||||||
|
password = d.get('password') or None # convert '' to None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
wallet = self.daemon.load_wallet(wallet_file, d['password'], upgrade=True)
|
wallet = self.daemon.load_wallet(wallet_file, password, upgrade=True)
|
||||||
return wallet
|
return wallet
|
||||||
except WalletRequiresSplit as e:
|
except WalletRequiresSplit as e:
|
||||||
wizard.run_split(wallet_file, e._split_data)
|
wizard.run_split(wallet_file, e._split_data)
|
||||||
@@ -454,8 +456,8 @@ class ElectrumGui(BaseElectrumGui, Logger):
|
|||||||
action = db.get_action()
|
action = db.get_action()
|
||||||
assert action[1] == 'accept_terms_of_use', 'only support for resuming trustedcoin split setup'
|
assert action[1] == 'accept_terms_of_use', 'only support for resuming trustedcoin split setup'
|
||||||
k1 = load_keystore(db, 'x1')
|
k1 = load_keystore(db, 'x1')
|
||||||
if 'password' in d and d['password']:
|
if password is not None:
|
||||||
xprv = k1.get_master_private_key(d['password'])
|
xprv = k1.get_master_private_key(password)
|
||||||
else:
|
else:
|
||||||
xprv = db.get('x1')['xprv']
|
xprv = db.get('x1')['xprv']
|
||||||
if not is_xprv(xprv):
|
if not is_xprv(xprv):
|
||||||
|
|||||||
Reference in New Issue
Block a user