Skip to content

Commit

Permalink
Merge bitcoin#10390: [wallet] remove minimum total fee option
Browse files Browse the repository at this point in the history
091a9ae remove minimum total fee option (Gregory Sanders)

Tree-SHA512: 9be4df3dab0219f30917211408f47b242f7c96dd7663b06ab1cf3cc63027f14956dc680883be6c58673b6452d0f339cf893694e4f21d0d248e70760614d5a344
  • Loading branch information
laanwj authored and PastaPastaPasta committed Jun 19, 2019
1 parent a0a563a commit 91aa37d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 46 deletions.
4 changes: 1 addition & 3 deletions src/qt/coincontroldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,6 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)

// Fee
nPayFee = CWallet::GetMinimumFee(nBytes, nTxConfirmTarget, ::mempool, ::feeEstimator);
if (nPayFee > 0 && coinControl->nMinimumTotalFee > nPayFee)
nPayFee = coinControl->nMinimumTotalFee;

// InstantSend Fee
if (coinControl->fUseInstantSend) nPayFee = std::max(nPayFee, CTxLockRequest(txDummy).GetMinFee(true));
Expand Down Expand Up @@ -627,7 +625,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
l5->setText(((nBytes > 0) ? ASYMP_UTF8 : "") + QString::number(nBytes)); // Bytes
l7->setText(fDust ? tr("yes") : tr("no")); // Dust
l8->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nChange)); // Change
if (nPayFee > 0 && (coinControl->nMinimumTotalFee < nPayFee))
if (nPayFee > 0)
{
l3->setText(ASYMP_UTF8 + l3->text());
l4->setText(ASYMP_UTF8 + l4->text());
Expand Down
13 changes: 0 additions & 13 deletions src/qt/forms/sendcoinsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -861,19 +861,6 @@
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioCustomAtLeast">
<property name="toolTip">
<string>If the custom fee is set to 1000 duffs and the transaction is only 250 bytes, then &quot;per kilobyte&quot; only pays 250 duffs in fee,&lt;br /&gt;while &quot;total at least&quot; pays 1000 duffs. For transactions bigger than a kilobyte both pay by kilobyte.</string>
</property>
<property name="text">
<string>total at least</string>
</property>
<attribute name="buttonGroup">
<string notr="true">groupCustomFee</string>
</attribute>
</widget>
</item>
<item>
<widget class="BitcoinAmountField" name="customFee"/>
</item>
Expand Down
24 changes: 0 additions & 24 deletions src/qt/sendcoinsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p
ui->groupFee->setId(ui->radioCustomFee, 1);
ui->groupFee->button((int)std::max(0, std::min(1, settings.value("nFeeRadio").toInt())))->setChecked(true);
ui->groupCustomFee->setId(ui->radioCustomPerKilobyte, 0);
ui->groupCustomFee->setId(ui->radioCustomAtLeast, 1);
ui->groupCustomFee->button((int)std::max(0, std::min(1, settings.value("nCustomFeeRadio").toInt())))->setChecked(true);
ui->customFee->setValue(settings.value("nTransactionFee").toLongLong());
ui->checkBoxMinimumFee->setChecked(settings.value("fPayOnlyMinFee").toBool());
Expand Down Expand Up @@ -717,7 +716,6 @@ void SendCoinsDialog::updateFeeSectionControls()
ui->checkBoxMinimumFee ->setEnabled(ui->radioCustomFee->isChecked());
ui->labelMinFeeWarning ->setEnabled(ui->radioCustomFee->isChecked());
ui->radioCustomPerKilobyte ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
ui->radioCustomAtLeast ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked() && CoinControlDialog::coinControl->HasSelected());
ui->customFee ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
}

Expand All @@ -728,19 +726,12 @@ void SendCoinsDialog::updateGlobalFeeVariables()
int nConfirmTarget = ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 2;
payTxFee = CFeeRate(0);

// set nMinimumTotalFee to 0 to not accidentally pay a custom fee
CoinControlDialog::coinControl->nMinimumTotalFee = 0;

// show the estimated required time for confirmation
ui->confirmationTargetLabel->setText(GUIUtil::formatDurationStr(nConfirmTarget * Params().GetConsensus().nPowTargetSpacing) + " / " + tr("%n block(s)", "", nConfirmTarget));
}
else
{
payTxFee = CFeeRate(ui->customFee->value());

// if user has selected to set a minimum absolute fee, pass the value to coincontrol
// set nMinimumTotalFee to 0 in case of user has selected that the fee is per KB
CoinControlDialog::coinControl->nMinimumTotalFee = ui->radioCustomAtLeast->isChecked() ? ui->customFee->value() : 0;
}
}

Expand Down Expand Up @@ -939,21 +930,6 @@ void SendCoinsDialog::coinControlUpdateLabels()
if (!model || !model->getOptionsModel())
return;

if (model->getOptionsModel()->getCoinControlFeatures())
{
// enable minimum absolute fee UI controls
ui->radioCustomAtLeast->setVisible(true);

// only enable the feature if inputs are selected
ui->radioCustomAtLeast->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked() &&CoinControlDialog::coinControl->HasSelected());
}
else
{
// in case coin control is disabled (=default), hide minimum absolute fee UI controls
ui->radioCustomAtLeast->setVisible(false);
return;
}

// set pay amounts
CoinControlDialog::payAmounts.clear();
CoinControlDialog::fSubtractFeeFromAmount = false;
Expand Down
3 changes: 0 additions & 3 deletions src/wallet/coincontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ class CCoinControl
bool fRequireAllInputs;
//! Includes watch only addresses which match the ISMINE_WATCH_SOLVABLE criteria
bool fAllowWatchOnly;
//! Minimum absolute fee (not per kilobyte)
CAmount nMinimumTotalFee;
//! Override estimated feerate
bool fOverrideFeeRate;
//! Feerate to use if overrideFeeRate is true
Expand All @@ -43,7 +41,6 @@ class CCoinControl
setSelected.clear();
fUseInstantSend = false;
fUsePrivateSend = true;
nMinimumTotalFee = 0;
nFeeRate = CFeeRate(0);
fOverrideFeeRate = false;
nConfirmTarget = 0;
Expand Down
5 changes: 2 additions & 3 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3678,9 +3678,8 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
currentConfirmationTarget = coinControl->nConfirmTarget;

CAmount nFeeNeeded = std::max(nFeePay, GetMinimumFee(nBytes, currentConfirmationTarget, ::mempool, ::feeEstimator));
if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) {
nFeeNeeded = coinControl->nMinimumTotalFee;
}
if (coinControl && coinControl->fOverrideFeeRate)
nFeeNeeded = coinControl->nFeeRate.GetFee(nBytes);
if(fUseInstantSend) {
nFeeNeeded = std::max(nFeeNeeded, CTxLockRequest(txNew).GetMinFee(true));
}
Expand Down

0 comments on commit 91aa37d

Please sign in to comment.