From 4c495413e138ec1dd6874e41b44e689f0c15e0e3 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Fri, 15 Jul 2022 11:34:21 -0400 Subject: Disallow encryption of watchonly wallets Watchonly wallets do not have any private keys to encrypt. It does not make sense to encrypt such wallets, so disable the option to encrypt them. This avoids an assertion that can be hit when encrypting watchonly descriptor wallets. --- src/qt/bitcoingui.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/qt/bitcoingui.cpp') diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 35e32f515b..baad0fdd91 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1350,6 +1350,12 @@ void BitcoinGUI::setEncryptionStatus(int status) { switch(status) { + case WalletModel::NoKeys: + labelWalletEncryptionIcon->hide(); + encryptWalletAction->setChecked(false); + changePassphraseAction->setEnabled(false); + encryptWalletAction->setEnabled(false); + break; case WalletModel::Unencrypted: labelWalletEncryptionIcon->hide(); encryptWalletAction->setChecked(false); -- cgit v1.2.3