Skip to content

Commit fa5a4cd

Browse files
author
MarcoFalke
committed
gui: Generate bech32 addresses by default (take 2, fixup)
1 parent 74f1a27 commit fa5a4cd

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/interfaces/node.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ class NodeImpl : public Node
198198
return GuessVerificationProgress(Params().TxData(), tip);
199199
}
200200
bool isInitialBlockDownload() override { return ::ChainstateActive().IsInitialBlockDownload(); }
201+
bool isAddressTypeSet() override { return !::gArgs.GetArg("-addresstype", "").empty(); }
201202
bool getReindex() override { return ::fReindex; }
202203
bool getImporting() override { return ::fImporting; }
203204
void setNetworkActive(bool active) override

src/interfaces/node.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ class Node
150150
//! Is initial block download.
151151
virtual bool isInitialBlockDownload() = 0;
152152

153+
//! Is -addresstype set.
154+
virtual bool isAddressTypeSet() = 0;
155+
153156
//! Get reindex.
154157
virtual bool getReindex() = 0;
155158

src/qt/receivecoinsdialog.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <qt/receivecoinsdialog.h>
88
#include <qt/forms/ui_receivecoinsdialog.h>
99

10+
#include <interfaces/node.h>
1011
#include <qt/addresstablemodel.h>
1112
#include <qt/optionsmodel.h>
1213
#include <qt/platformstyle.h>
@@ -92,10 +93,16 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model)
9293
// Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
9394
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this);
9495

95-
if (model->wallet().getDefaultAddressType() == OutputType::BECH32) {
96-
ui->useLegacyAddress->setCheckState(Qt::Unchecked);
96+
if (model->node().isAddressTypeSet()) {
97+
// user explicitly set the type, use it
98+
if (model->wallet().getDefaultAddressType() == OutputType::BECH32) {
99+
ui->useLegacyAddress->setCheckState(Qt::Unchecked);
100+
} else {
101+
ui->useLegacyAddress->setCheckState(Qt::Checked);
102+
}
97103
} else {
98-
ui->useLegacyAddress->setCheckState(Qt::Checked);
104+
// Always fall back to bech32 in the gui
105+
ui->useLegacyAddress->setCheckState(Qt::Unchecked);
99106
}
100107

101108
// Set the button to be enabled or disabled based on whether the wallet can give out new addresses.

0 commit comments

Comments
 (0)