Merge #16497: gui: Generate bech32 addresses by default (take 2, fixup)

fa5a4cd813 gui: Generate bech32 addresses by default (take 2, fixup) (MarcoFalke)

Pull request description:

  This commit was missing from my previous pull request for some reason 🤔 :

  *    gui: Generate bech32 addresses by default #15711

ACKs for top commit:
  jonasschnelli:
    Tested ACK fa5a4cd813
  promag:
    ACK fa5a4cd813.
  fanquake:
    ACK fa5a4cd813

Tree-SHA512: 4a38df929d7704bf08e50a2e814b2e6cd25c4165d040a84287045b44e32f4708750845520d64170ea58e41de3ca496da4625d3eb375f9528b21b364c22068a6b
This commit is contained in:
fanquake 2019-08-06 09:31:09 +08:00
commit 31d98584f3
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1
3 changed files with 14 additions and 3 deletions

View file

@ -198,6 +198,7 @@ public:
return GuessVerificationProgress(Params().TxData(), tip); return GuessVerificationProgress(Params().TxData(), tip);
} }
bool isInitialBlockDownload() override { return ::ChainstateActive().IsInitialBlockDownload(); } bool isInitialBlockDownload() override { return ::ChainstateActive().IsInitialBlockDownload(); }
bool isAddressTypeSet() override { return !::gArgs.GetArg("-addresstype", "").empty(); }
bool getReindex() override { return ::fReindex; } bool getReindex() override { return ::fReindex; }
bool getImporting() override { return ::fImporting; } bool getImporting() override { return ::fImporting; }
void setNetworkActive(bool active) override void setNetworkActive(bool active) override

View file

@ -150,6 +150,9 @@ public:
//! Is initial block download. //! Is initial block download.
virtual bool isInitialBlockDownload() = 0; virtual bool isInitialBlockDownload() = 0;
//! Is -addresstype set.
virtual bool isAddressTypeSet() = 0;
//! Get reindex. //! Get reindex.
virtual bool getReindex() = 0; virtual bool getReindex() = 0;

View file

@ -7,6 +7,7 @@
#include <qt/receivecoinsdialog.h> #include <qt/receivecoinsdialog.h>
#include <qt/forms/ui_receivecoinsdialog.h> #include <qt/forms/ui_receivecoinsdialog.h>
#include <interfaces/node.h>
#include <qt/addresstablemodel.h> #include <qt/addresstablemodel.h>
#include <qt/optionsmodel.h> #include <qt/optionsmodel.h>
#include <qt/platformstyle.h> #include <qt/platformstyle.h>
@ -92,10 +93,16 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model)
// Last 2 columns are set by the columnResizingFixer, when the table geometry is ready. // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this); columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this);
if (model->wallet().getDefaultAddressType() == OutputType::BECH32) { if (model->node().isAddressTypeSet()) {
ui->useLegacyAddress->setCheckState(Qt::Unchecked); // user explicitly set the type, use it
if (model->wallet().getDefaultAddressType() == OutputType::BECH32) {
ui->useLegacyAddress->setCheckState(Qt::Unchecked);
} else {
ui->useLegacyAddress->setCheckState(Qt::Checked);
}
} else { } else {
ui->useLegacyAddress->setCheckState(Qt::Checked); // Always fall back to bech32 in the gui
ui->useLegacyAddress->setCheckState(Qt::Unchecked);
} }
// Set the button to be enabled or disabled based on whether the wallet can give out new addresses. // Set the button to be enabled or disabled based on whether the wallet can give out new addresses.