mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
Merge pull request #7096
ff723da
[Qt] improve minimum absolute fee option - Only display the minimum absolute fee control if CoinControl is enabled (Jonas Schnelli)31b508a
[Qt] make use of the nMinimumTotalFee (absolute) in coincontrols fee calculation (Jonas Schnelli)80462dd
[Qt] use ASYMP_UTF8 (≈) whenever we show a fee that is not absolute (Jonas Schnelli)ecc7c82
Move fPayAtLeastCustomFee function to CC (Pieter Wuille)
This commit is contained in:
commit
9490bd71bd
@ -16,6 +16,8 @@ public:
|
||||
bool fAllowOtherInputs;
|
||||
//! Includes watch only addresses which match the ISMINE_WATCH_SOLVABLE criteria
|
||||
bool fAllowWatchOnly;
|
||||
//! Minimum absolute fee (not per kilobyte)
|
||||
CAmount nMinimumTotalFee;
|
||||
|
||||
CCoinControl()
|
||||
{
|
||||
@ -28,6 +30,7 @@ public:
|
||||
fAllowOtherInputs = false;
|
||||
fAllowWatchOnly = false;
|
||||
setSelected.clear();
|
||||
nMinimumTotalFee = 0;
|
||||
}
|
||||
|
||||
bool HasSelected() const
|
||||
|
@ -549,6 +549,9 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||
|
||||
// Fee
|
||||
nPayFee = CWallet::GetMinimumFee(nBytes, nTxConfirmTarget, mempool);
|
||||
if (nPayFee > 0 && coinControl->nMinimumTotalFee > nPayFee)
|
||||
nPayFee = coinControl->nMinimumTotalFee;
|
||||
|
||||
|
||||
// Allow free? (require at least hard-coded threshold and default to that if no estimate)
|
||||
double dPriorityNeeded = std::max(mempoolEstimatePriority, AllowFreeThreshold());
|
||||
@ -619,7 +622,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||
l6->setText(sPriorityLabel); // Priority
|
||||
l7->setText(fDust ? tr("yes") : tr("no")); // Dust
|
||||
l8->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nChange)); // Change
|
||||
if (nPayFee > 0 && !(payTxFee.GetFeePerK() > 0 && fPayAtLeastCustomFee && nBytes < 1000))
|
||||
if (nPayFee > 0 && (coinControl->nMinimumTotalFee < nPayFee))
|
||||
{
|
||||
l3->setText(ASYMP_UTF8 + l3->text());
|
||||
l4->setText(ASYMP_UTF8 + l4->text());
|
||||
|
@ -585,7 +585,7 @@ 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());
|
||||
ui->radioCustomAtLeast ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked() && CoinControlDialog::coinControl->HasSelected());
|
||||
ui->customFee ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
|
||||
}
|
||||
|
||||
@ -600,7 +600,10 @@ void SendCoinsDialog::updateGlobalFeeVariables()
|
||||
{
|
||||
nTxConfirmTarget = defaultConfirmTarget;
|
||||
payTxFee = CFeeRate(ui->customFee->value());
|
||||
fPayAtLeastCustomFee = ui->radioCustomAtLeast->isChecked();
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
fSendFreeTransactions = ui->checkBoxFreeTx->isChecked();
|
||||
@ -707,7 +710,6 @@ void SendCoinsDialog::coinControlFeatureChanged(bool checked)
|
||||
if (!checked && model) // coin control features disabled
|
||||
CoinControlDialog::coinControl->SetNull();
|
||||
|
||||
if (checked)
|
||||
coinControlUpdateLabels();
|
||||
}
|
||||
|
||||
@ -782,9 +784,24 @@ void SendCoinsDialog::coinControlChangeEdited(const QString& text)
|
||||
// Coin Control: update labels
|
||||
void SendCoinsDialog::coinControlUpdateLabels()
|
||||
{
|
||||
if (!model || !model->getOptionsModel() || !model->getOptionsModel()->getCoinControlFeatures())
|
||||
if (!model || !model->getOptionsModel())
|
||||
return;
|
||||
|
||||
if (model->getOptionsModel()->getCoinControlFeatures())
|
||||
{
|
||||
// enable minium absolute fee UI controls
|
||||
ui->radioCustomAtLeast->setVisible(true);
|
||||
|
||||
// only enable the feature if inputs are selected
|
||||
ui->radioCustomAtLeast->setEnabled(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;
|
||||
|
@ -41,7 +41,6 @@ CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE;
|
||||
unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET;
|
||||
bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE;
|
||||
bool fSendFreeTransactions = DEFAULT_SEND_FREE_TRANSACTIONS;
|
||||
bool fPayAtLeastCustomFee = false;
|
||||
|
||||
/**
|
||||
* Fees smaller than this (in satoshi) are considered zero fee (for transaction creation)
|
||||
@ -2096,6 +2095,9 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||
}
|
||||
|
||||
CAmount nFeeNeeded = GetMinimumFee(nBytes, nTxConfirmTarget, mempool);
|
||||
if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) {
|
||||
nFeeNeeded = coinControl->nMinimumTotalFee;
|
||||
}
|
||||
|
||||
// If we made it here and we aren't even able to meet the relay fee on the next pass, give up
|
||||
// because we must be at the maximum allowed fee.
|
||||
@ -2191,9 +2193,6 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge
|
||||
{
|
||||
// payTxFee is user-set "I want to pay this much"
|
||||
CAmount nFeeNeeded = payTxFee.GetFee(nTxBytes);
|
||||
// user selected total at least (default=true)
|
||||
if (fPayAtLeastCustomFee && nFeeNeeded > 0 && nFeeNeeded < payTxFee.GetFeePerK())
|
||||
nFeeNeeded = payTxFee.GetFeePerK();
|
||||
// User didn't set: use -txconfirmtarget to estimate...
|
||||
if (nFeeNeeded == 0) {
|
||||
int estimateFoundTarget = nConfirmTarget;
|
||||
|
@ -35,7 +35,6 @@ extern CAmount maxTxFee;
|
||||
extern unsigned int nTxConfirmTarget;
|
||||
extern bool bSpendZeroConfChange;
|
||||
extern bool fSendFreeTransactions;
|
||||
extern bool fPayAtLeastCustomFee;
|
||||
|
||||
static const unsigned int DEFAULT_KEYPOOL_SIZE = 100;
|
||||
//! -paytxfee default
|
||||
|
Loading…
Reference in New Issue
Block a user