Skip to content

Commit ff723da

Browse files
committed
[Qt] improve minimum absolute fee option
- Only display the minimum absolute fee control if CoinControl is enabled
1 parent 31b508a commit ff723da

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

src/qt/sendcoinsdialog.cpp

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ void SendCoinsDialog::updateFeeSectionControls()
585585
ui->checkBoxMinimumFee ->setEnabled(ui->radioCustomFee->isChecked());
586586
ui->labelMinFeeWarning ->setEnabled(ui->radioCustomFee->isChecked());
587587
ui->radioCustomPerKilobyte ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
588-
ui->radioCustomAtLeast ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
588+
ui->radioCustomAtLeast ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked() && CoinControlDialog::coinControl->HasSelected());
589589
ui->customFee ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
590590
}
591591

@@ -600,7 +600,10 @@ void SendCoinsDialog::updateGlobalFeeVariables()
600600
{
601601
nTxConfirmTarget = defaultConfirmTarget;
602602
payTxFee = CFeeRate(ui->customFee->value());
603-
fPayAtLeastCustomFee = ui->radioCustomAtLeast->isChecked();
603+
604+
// if user has selected to set a minimum absolute fee, pass the value to coincontrol
605+
// set nMinimumTotalFee to 0 in case of user has selected that the fee is per KB
606+
CoinControlDialog::coinControl->nMinimumTotalFee = ui->radioCustomAtLeast->isChecked() ? ui->customFee->value() : 0;
604607
}
605608

606609
fSendFreeTransactions = ui->checkBoxFreeTx->isChecked();
@@ -707,8 +710,7 @@ void SendCoinsDialog::coinControlFeatureChanged(bool checked)
707710
if (!checked && model) // coin control features disabled
708711
CoinControlDialog::coinControl->SetNull();
709712

710-
if (checked)
711-
coinControlUpdateLabels();
713+
coinControlUpdateLabels();
712714
}
713715

714716
// Coin Control: button inputs -> show actual coin control dialog
@@ -782,9 +784,24 @@ void SendCoinsDialog::coinControlChangeEdited(const QString& text)
782784
// Coin Control: update labels
783785
void SendCoinsDialog::coinControlUpdateLabels()
784786
{
785-
if (!model || !model->getOptionsModel() || !model->getOptionsModel()->getCoinControlFeatures())
787+
if (!model || !model->getOptionsModel())
786788
return;
787789

790+
if (model->getOptionsModel()->getCoinControlFeatures())
791+
{
792+
// enable minium absolute fee UI controls
793+
ui->radioCustomAtLeast->setVisible(true);
794+
795+
// only enable the feature if inputs are selected
796+
ui->radioCustomAtLeast->setEnabled(CoinControlDialog::coinControl->HasSelected());
797+
}
798+
else
799+
{
800+
// in case coin control is disabled (=default), hide minimum absolute fee UI controls
801+
ui->radioCustomAtLeast->setVisible(false);
802+
return;
803+
}
804+
788805
// set pay amounts
789806
CoinControlDialog::payAmounts.clear();
790807
CoinControlDialog::fSubtractFeeFromAmount = false;

0 commit comments

Comments
 (0)