Skip to content

Commit 31d9858

Browse files
committed
Merge #16497: gui: Generate bech32 addresses by default (take 2, fixup)
fa5a4cd 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 fa5a4cd promag: ACK fa5a4cd. fanquake: ACK fa5a4cd Tree-SHA512: 4a38df929d7704bf08e50a2e814b2e6cd25c4165d040a84287045b44e32f4708750845520d64170ea58e41de3ca496da4625d3eb375f9528b21b364c22068a6b
2 parents 62117f9 + fa5a4cd commit 31d9858

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)