From 6dd2b8b471b9803e5f23c0b81e0751c8b8259966 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sat, 7 Oct 2017 08:19:14 +0200 Subject: [PATCH] fix #2861: error message when password is missing --- lib/commands.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/commands.py b/lib/commands.py index f2a54f449..2fb0cf13f 100644 --- 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