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.
This commit is contained in:
Andrew Chow
2022-07-15 11:34:21 -04:00
parent 85b601e043
commit 4c495413e1
3 changed files with 12 additions and 0 deletions

View File

@@ -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);