commit 6dd2b8b471b9803e5f23c0b81e0751c8b8259966 parent 252cb491c889fb84df965f9aff87165e11c9b08e Author: ThomasV <thomasv@electrum.org> Date: Sat, 7 Oct 2017 08:19:14 +0200 fix #2861: error message when password is missing Diffstat:
M | lib/commands.py | | | 6 | +++++- |
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/commands.py b/lib/commands.py @@ -84,8 +84,12 @@ def command(s): @wraps(func) def func_wrapper(*args, **kwargs): c = known_commands[func.__name__] - if c.requires_wallet and args[0].wallet is None: + wallet = args[0].wallet + password = kwargs.get('password') + if c.requires_wallet and wallet is None: raise BaseException("wallet not loaded. Use 'electrum daemon load_wallet'") + if c.requires_password and password is None and wallet.storage.get('use_encryption'): + return {'error': 'Password required' } return func(*args, **kwargs) return func_wrapper return decorator