From 9eb448ffe053dc1cc872183dd8f97fc091e0eabd Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 15 Sep 2023 15:54:25 +0200 Subject: [PATCH] follow-up previous commit --- electrum/commands.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/electrum/commands.py b/electrum/commands.py index 09ceea929..e75edf025 100644 --- a/electrum/commands.py +++ b/electrum/commands.py @@ -146,12 +146,12 @@ def command(s): if wallet is None: raise Exception('wallet not loaded') kwargs['wallet'] = wallet - if cmd.requires_password and password is None: - password = wallet.get_unlocked_password() - if password: - kwargs['password'] = password - else: - raise Exception('Password required. Unlock the wallet, or add a --password option to your command') + if cmd.requires_password and password is None and wallet.has_password(): + password = wallet.get_unlocked_password() + if password: + kwargs['password'] = password + else: + raise Exception('Password required. Unlock the wallet, or add a --password option to your command') wallet = kwargs.get('wallet') # type: Optional[Abstract_Wallet] if cmd.requires_wallet and not wallet: raise Exception('wallet not loaded')