Skip to content

Commit

Permalink
gui: ensure external signer option remains disabled without signers
Browse files Browse the repository at this point in the history
When no external signers are available, the option to enable external
signers should always be disabled. However the encrypt wallet checkbox
can erroneously re-enable the external signer checkbox. To avoid this,
CreateWalletDialog now stores whether signers were available during
setSigners so that future calls to external_signer_checkbox->setEnabled
can account for whether signers are available.

Github-Pull: bitcoin-core/gui#396
Rebased-From: a9b9ca8
  • Loading branch information
achow101 authored and hebasto committed Aug 9, 2021
1 parent 0ae7dd8 commit e055675
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/qt/createwalletdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CreateWalletDialog::CreateWalletDialog(QWidget* parent) :
// set to true, enable it when isEncryptWalletChecked is false.
ui->disable_privkeys_checkbox->setEnabled(!checked);
#ifdef ENABLE_EXTERNAL_SIGNER
ui->external_signer_checkbox->setEnabled(!checked);
ui->external_signer_checkbox->setEnabled(m_has_signers && !checked);
#endif
// When the disable_privkeys_checkbox is disabled, uncheck it.
if (!ui->disable_privkeys_checkbox->isEnabled()) {
Expand Down Expand Up @@ -115,7 +115,8 @@ CreateWalletDialog::~CreateWalletDialog()

void CreateWalletDialog::setSigners(const std::vector<ExternalSigner>& signers)
{
if (!signers.empty()) {
m_has_signers = !signers.empty();
if (m_has_signers) {
ui->external_signer_checkbox->setEnabled(true);
ui->external_signer_checkbox->setChecked(true);
ui->encrypt_wallet_checkbox->setEnabled(false);
Expand Down
1 change: 1 addition & 0 deletions src/qt/createwalletdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class CreateWalletDialog : public QDialog

private:
Ui::CreateWalletDialog *ui;
bool m_has_signers = false;
};

#endif // BITCOIN_QT_CREATEWALLETDIALOG_H

0 comments on commit e055675

Please sign in to comment.