Skip to content

Commit a16f44c

Browse files
committed
qt: Remove "Pay only required fee" checkbox
The custom fee input box now has a minimum value equal to the minimum required fee. Before a value below the minimum fee could be entered which was confusing since the minimum fee would still be paid even though a lower amount was entered.
1 parent 8711cc0 commit a16f44c

File tree

3 files changed

+13
-67
lines changed

3 files changed

+13
-67
lines changed

src/qt/forms/sendcoinsdialog.ui

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -878,28 +878,15 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p
878878
<item>
879879
<layout class="QHBoxLayout" name="horizontalLayoutFee8">
880880
<item>
881-
<widget class="QCheckBox" name="checkBoxMinimumFee">
882-
<property name="toolTip">
883-
<string>Paying only the minimum fee is just fine as long as there is less transaction volume than space in the blocks. But be aware that this can end up in a never confirming transaction once there is more demand for bitcoin transactions than the network can process.</string>
884-
</property>
885-
<property name="text">
886-
<string/>
887-
</property>
888-
</widget>
889-
</item>
890-
<item>
891-
<widget class="QLabel" name="labelMinFeeWarning">
881+
<widget class="QLabel" name="labelCustomFeeWarning">
892882
<property name="enabled">
893883
<bool>true</bool>
894884
</property>
895885
<property name="toolTip">
896-
<string>Paying only the minimum fee is just fine as long as there is less transaction volume than space in the blocks. But be aware that this can end up in a never confirming transaction once there is more demand for bitcoin transactions than the network can process.</string>
886+
<string>When there is less transaction volume than space in the blocks, miners as well as relaying nodes may enforce a minimum fee. Paying only this minimum fee is just fine, but be aware that this can result in a never confirming transaction once there is more demand for bitcoin transactions than the network can process.</string>
897887
</property>
898888
<property name="text">
899-
<string>(read the tooltip)</string>
900-
</property>
901-
<property name="margin">
902-
<number>5</number>
889+
<string>A too low fee might result in a never confirming transaction (read the tooltip)</string>
903890
</property>
904891
</widget>
905892
</item>
@@ -992,9 +979,6 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p
992979
<property name="text">
993980
<string/>
994981
</property>
995-
<property name="margin">
996-
<number>2</number>
997-
</property>
998982
</widget>
999983
</item>
1000984
<item>
@@ -1009,9 +993,6 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p
1009993
<property name="text">
1010994
<string>(Smart fee not initialized yet. This usually takes a few blocks...)</string>
1011995
</property>
1012-
<property name="margin">
1013-
<number>2</number>
1014-
</property>
1015996
</widget>
1016997
</item>
1017998
<item>
@@ -1038,24 +1019,8 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p
10381019
<property name="text">
10391020
<string>Confirmation time target:</string>
10401021
</property>
1041-
<property name="margin">
1042-
<number>2</number>
1043-
</property>
10441022
</widget>
10451023
</item>
1046-
<item>
1047-
<spacer name="verticalSpacer_3">
1048-
<property name="orientation">
1049-
<enum>Qt::Vertical</enum>
1050-
</property>
1051-
<property name="sizeHint" stdset="0">
1052-
<size>
1053-
<width>1</width>
1054-
<height>1</height>
1055-
</size>
1056-
</property>
1057-
</spacer>
1058-
</item>
10591024
</layout>
10601025
</item>
10611026
<item>

src/qt/sendcoinsdialog.cpp

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,11 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p
119119
settings.setValue("nSmartFeeSliderPosition", 0);
120120
if (!settings.contains("nTransactionFee"))
121121
settings.setValue("nTransactionFee", (qint64)DEFAULT_PAY_TX_FEE);
122-
if (!settings.contains("fPayOnlyMinFee"))
123-
settings.setValue("fPayOnlyMinFee", false);
124122
ui->groupFee->setId(ui->radioSmartFee, 0);
125123
ui->groupFee->setId(ui->radioCustomFee, 1);
126124
ui->groupFee->button((int)std::max(0, std::min(1, settings.value("nFeeRadio").toInt())))->setChecked(true);
125+
ui->customFee->SetAllowEmpty(false);
127126
ui->customFee->setValue(settings.value("nTransactionFee").toLongLong());
128-
ui->checkBoxMinimumFee->setChecked(settings.value("fPayOnlyMinFee").toBool());
129127
minimizeFeeSection(settings.value("fFeeSectionMinimized").toBool());
130128
}
131129

@@ -174,14 +172,15 @@ void SendCoinsDialog::setModel(WalletModel *_model)
174172
connect(ui->groupFee, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::updateFeeSectionControls);
175173
connect(ui->groupFee, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &SendCoinsDialog::coinControlUpdateLabels);
176174
connect(ui->customFee, &BitcoinAmountField::valueChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
177-
connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, &SendCoinsDialog::setMinimumFee);
178-
connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, &SendCoinsDialog::updateFeeSectionControls);
179-
connect(ui->checkBoxMinimumFee, &QCheckBox::stateChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
180175
connect(ui->optInRBF, &QCheckBox::stateChanged, this, &SendCoinsDialog::updateSmartFeeLabel);
181176
connect(ui->optInRBF, &QCheckBox::stateChanged, this, &SendCoinsDialog::coinControlUpdateLabels);
182-
ui->customFee->setSingleStep(model->wallet().getRequiredFee(1000));
177+
CAmount requiredFee = model->wallet().getRequiredFee(1000);
178+
ui->customFee->SetMinValue(requiredFee);
179+
if (ui->customFee->value() < requiredFee) {
180+
ui->customFee->setValue(requiredFee);
181+
}
182+
ui->customFee->setSingleStep(requiredFee);
183183
updateFeeSectionControls();
184-
updateMinFeeLabel();
185184
updateSmartFeeLabel();
186185

187186
// set default rbf checkbox state
@@ -210,7 +209,6 @@ SendCoinsDialog::~SendCoinsDialog()
210209
settings.setValue("nFeeRadio", ui->groupFee->checkedId());
211210
settings.setValue("nConfTarget", getConfTargetForIndex(ui->confTargetSelector->currentIndex()));
212211
settings.setValue("nTransactionFee", (qint64)ui->customFee->value());
213-
settings.setValue("fPayOnlyMinFee", ui->checkBoxMinimumFee->isChecked());
214212

215213
delete ui;
216214
}
@@ -542,7 +540,6 @@ void SendCoinsDialog::updateDisplayUnit()
542540
{
543541
setBalance(model->wallet().getBalances());
544542
ui->customFee->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
545-
updateMinFeeLabel();
546543
updateSmartFeeLabel();
547544
}
548545

@@ -642,22 +639,16 @@ void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry)
642639
}
643640
}
644641

645-
void SendCoinsDialog::setMinimumFee()
646-
{
647-
ui->customFee->setValue(model->wallet().getRequiredFee(1000));
648-
}
649-
650642
void SendCoinsDialog::updateFeeSectionControls()
651643
{
652644
ui->confTargetSelector ->setEnabled(ui->radioSmartFee->isChecked());
653645
ui->labelSmartFee ->setEnabled(ui->radioSmartFee->isChecked());
654646
ui->labelSmartFee2 ->setEnabled(ui->radioSmartFee->isChecked());
655647
ui->labelSmartFee3 ->setEnabled(ui->radioSmartFee->isChecked());
656648
ui->labelFeeEstimation ->setEnabled(ui->radioSmartFee->isChecked());
657-
ui->checkBoxMinimumFee ->setEnabled(ui->radioCustomFee->isChecked());
658-
ui->labelMinFeeWarning ->setEnabled(ui->radioCustomFee->isChecked());
659-
ui->labelCustomPerKilobyte ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
660-
ui->customFee ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
649+
ui->labelCustomFeeWarning ->setEnabled(ui->radioCustomFee->isChecked());
650+
ui->labelCustomPerKilobyte ->setEnabled(ui->radioCustomFee->isChecked());
651+
ui->customFee ->setEnabled(ui->radioCustomFee->isChecked());
661652
}
662653

663654
void SendCoinsDialog::updateFeeMinimizedLabel()
@@ -672,14 +663,6 @@ void SendCoinsDialog::updateFeeMinimizedLabel()
672663
}
673664
}
674665

675-
void SendCoinsDialog::updateMinFeeLabel()
676-
{
677-
if (model && model->getOptionsModel())
678-
ui->checkBoxMinimumFee->setText(tr("Pay only the required fee of %1").arg(
679-
BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), model->wallet().getRequiredFee(1000)) + "/kB")
680-
);
681-
}
682-
683666
void SendCoinsDialog::updateCoinControlState(CCoinControl& ctrl)
684667
{
685668
if (ui->radioCustomFee->isChecked()) {

src/qt/sendcoinsdialog.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ private Q_SLOTS:
9292
void coinControlClipboardBytes();
9393
void coinControlClipboardLowOutput();
9494
void coinControlClipboardChange();
95-
void setMinimumFee();
9695
void updateFeeSectionControls();
97-
void updateMinFeeLabel();
9896
void updateSmartFeeLabel();
9997

10098
Q_SIGNALS:

0 commit comments

Comments
 (0)