Skip to content

Commit 943fb5e

Browse files
committed
gui: add taproot checkbox
1 parent e58099d commit 943fb5e

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

src/qt/forms/receivecoinsdialog.ui

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,31 @@
219219
</property>
220220
</widget>
221221
</item>
222+
<item>
223+
<widget class="QCheckBox" name="useTaproot">
224+
<property name="sizePolicy">
225+
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
226+
<horstretch>0</horstretch>
227+
<verstretch>0</verstretch>
228+
</sizepolicy>
229+
</property>
230+
<property name="maximumSize">
231+
<size>
232+
<width>1000</width>
233+
<height>16777215</height>
234+
</size>
235+
</property>
236+
<property name="focusPolicy">
237+
<enum>Qt::StrongFocus</enum>
238+
</property>
239+
<property name="toolTip">
240+
<string>Although the addresses (Bech32m or BIP-350) in Taproot look very similiar to Bech32 addresses, some wallets are not yet able to send to them.</string>
241+
</property>
242+
<property name="text">
243+
<string>Use Taproot</string>
244+
</property>
245+
</widget>
246+
</item>
222247
<item>
223248
<spacer name="horizontalSpacer_3">
224249
<property name="orientation">

src/qt/receivecoinsdialog.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,15 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model)
8787
&QItemSelectionModel::selectionChanged, this,
8888
&ReceiveCoinsDialog::recentRequestsView_selectionChanged);
8989

90-
if (model->wallet().getDefaultAddressType() == OutputType::BECH32) {
90+
const OutputType address_type = model->wallet().getDefaultAddressType();
91+
if (address_type == OutputType::BECH32 || address_type == OutputType::BECH32M) {
9192
ui->useBech32->setCheckState(Qt::Checked);
9293
} else {
9394
ui->useBech32->setCheckState(Qt::Unchecked);
9495
}
9596

97+
ui->useTaproot->setVisible(model->wallet().taprootEnabled());
98+
9699
// Set the button to be enabled or disabled based on whether the wallet can give out new addresses.
97100
ui->receiveButton->setEnabled(model->wallet().canGetAddresses());
98101

@@ -146,10 +149,10 @@ void ReceiveCoinsDialog::on_receiveButton_clicked()
146149
/* Generate new receiving address */
147150
OutputType address_type;
148151
if (ui->useBech32->isChecked()) {
149-
address_type = OutputType::BECH32;
152+
address_type = ui->useTaproot->isChecked() ? OutputType::BECH32M : OutputType::BECH32;
150153
} else {
151154
address_type = model->wallet().getDefaultAddressType();
152-
if (address_type == OutputType::BECH32) {
155+
if (address_type == OutputType::BECH32 || address_type == OutputType::BECH32M) {
153156
address_type = OutputType::P2SH_SEGWIT;
154157
}
155158
}

0 commit comments

Comments
 (0)