Skip to content

Commit 82dda6b

Browse files
luke-jrfanquake
authored andcommitted
GUI: Allow generating Bech32 addresses with a legacy-address default
1 parent 7ab1c6f commit 82dda6b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/qt/receivecoinsdialog.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,11 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model)
9494
// Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
9595
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this);
9696

97-
// configure bech32 checkbox, disable if launched with legacy as default:
9897
if (model->wallet().getDefaultAddressType() == OutputType::BECH32) {
9998
ui->useBech32->setCheckState(Qt::Checked);
10099
} else {
101100
ui->useBech32->setCheckState(Qt::Unchecked);
102101
}
103-
104-
ui->useBech32->setVisible(model->wallet().getDefaultAddressType() != OutputType::LEGACY);
105102
}
106103
}
107104

@@ -144,9 +141,14 @@ void ReceiveCoinsDialog::on_receiveButton_clicked()
144141
QString address;
145142
QString label = ui->reqLabel->text();
146143
/* Generate new receiving address */
147-
OutputType address_type = model->wallet().getDefaultAddressType();
148-
if (address_type != OutputType::LEGACY) {
149-
address_type = ui->useBech32->isChecked() ? OutputType::BECH32 : OutputType::P2SH_SEGWIT;
144+
OutputType address_type;
145+
if (ui->useBech32->isChecked()) {
146+
address_type = OutputType::BECH32;
147+
} else {
148+
address_type = model->wallet().getDefaultAddressType();
149+
if (address_type == OutputType::BECH32) {
150+
address_type = OutputType::P2SH_SEGWIT;
151+
}
150152
}
151153
address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, "", address_type);
152154
SendCoinsRecipient info(address, label,

0 commit comments

Comments
 (0)