Revise fee UI
* Change from a block target number to using speed labels which pick predefined fee values. * Remove smart fee labels from send coins control dialog. * Rename slider position configuration for Qt, as smart fee slider settings are not compatible with preset fee settings.
This commit is contained in:
parent
661197f502
commit
36e39a395d
|
@ -18,6 +18,50 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
|
|
||||||
|
CFeeRate GetDogecoinFeeRate(int priority)
|
||||||
|
{
|
||||||
|
switch(priority)
|
||||||
|
{
|
||||||
|
case SUCH_EXPENSIVE:
|
||||||
|
return CFeeRate(COIN / 100 * 521); // 5.21 DOGE, but very carefully avoiding floating point maths
|
||||||
|
case MANY_GENEROUS:
|
||||||
|
return CFeeRate(CWallet::minTxFee.GetFeePerK() * 100);
|
||||||
|
case AMAZE:
|
||||||
|
return CFeeRate(CWallet::minTxFee.GetFeePerK() * 10);
|
||||||
|
case WOW:
|
||||||
|
return CFeeRate(CWallet::minTxFee.GetFeePerK() * 5);
|
||||||
|
case MORE:
|
||||||
|
return CFeeRate(CWallet::minTxFee.GetFeePerK() * 2);
|
||||||
|
case MINIMUM:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return CWallet::minTxFee;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string GetDogecoinPriorityLabel(int priority)
|
||||||
|
{
|
||||||
|
switch(priority)
|
||||||
|
{
|
||||||
|
case SUCH_EXPENSIVE:
|
||||||
|
return _("Such expensive");
|
||||||
|
case MANY_GENEROUS:
|
||||||
|
return _("Many generous");
|
||||||
|
case AMAZE:
|
||||||
|
return _("Amaze");
|
||||||
|
case WOW:
|
||||||
|
return _("Wow");
|
||||||
|
case MORE:
|
||||||
|
return _("More");
|
||||||
|
case MINIMUM:
|
||||||
|
return _("Minimum");
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return _("Default");
|
||||||
|
}
|
||||||
|
|
||||||
//mlumin 5/2021: walletfees, all attached to GetDogecoinWalletFeeRate which is just the newly exposed ::minWalletTxFee
|
//mlumin 5/2021: walletfees, all attached to GetDogecoinWalletFeeRate which is just the newly exposed ::minWalletTxFee
|
||||||
CAmount GetDogecoinWalletFee(size_t nBytes_)
|
CAmount GetDogecoinWalletFee(size_t nBytes_)
|
||||||
{
|
{
|
||||||
|
@ -31,7 +75,7 @@ CAmount GetDogecoinWalletFee(size_t nBytes_)
|
||||||
CFeeRate GetDogecoinWalletFeeRate()
|
CFeeRate GetDogecoinWalletFeeRate()
|
||||||
{
|
{
|
||||||
//mlumin 5/2021: currently 1x COIN or 1 dogecoin or 100,000,000 koinu
|
//mlumin 5/2021: currently 1x COIN or 1 dogecoin or 100,000,000 koinu
|
||||||
return ::minWalletTxFeeRate;
|
return CWallet::minTxFee;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,32 @@
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
|
#ifndef BITCOIN_DOGECOIN_FEES_H
|
||||||
|
#define BITCOIN_DOGECOIN_FEES_H
|
||||||
|
|
||||||
#include "amount.h"
|
#include "amount.h"
|
||||||
#include "chain.h"
|
#include "chain.h"
|
||||||
#include "chainparams.h"
|
#include "chainparams.h"
|
||||||
|
|
||||||
#ifdef ENABLE_WALLET
|
#ifdef ENABLE_WALLET
|
||||||
|
|
||||||
|
enum FeeRatePreset
|
||||||
|
{
|
||||||
|
MINIMUM,
|
||||||
|
MORE,
|
||||||
|
WOW,
|
||||||
|
AMAZE,
|
||||||
|
MANY_GENEROUS,
|
||||||
|
SUCH_EXPENSIVE
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Estimate fee rate needed to get into the next nBlocks */
|
||||||
|
CFeeRate GetDogecoinFeeRate(int priority);
|
||||||
|
const std::string GetDogecoinPriorityLabel(int priority);
|
||||||
CFeeRate GetDogecoinWalletFeeRate();
|
CFeeRate GetDogecoinWalletFeeRate();
|
||||||
CAmount GetDogecoinMinWalletFee(unsigned int nBytes_);
|
CAmount GetDogecoinMinWalletFee(unsigned int nBytes_);
|
||||||
#endif
|
#endif // ENABLE_WALLET
|
||||||
CAmount GetDogecoinMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree);
|
CAmount GetDogecoinMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree);
|
||||||
CAmount GetDogecoinDustFee(const std::vector<CTxOut> &vout, CFeeRate &baseFeeRate);
|
CAmount GetDogecoinDustFee(const std::vector<CTxOut> &vout, CFeeRate &baseFeeRate);
|
||||||
|
|
||||||
|
#endif // BITCOIN_DOGECOIN_FEES_H
|
||||||
|
|
|
@ -1005,7 +1005,7 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayoutFee12">
|
<layout class="QHBoxLayout" name="horizontalLayoutFee12">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelSmartFee">
|
<widget class="QLabel" name="labelPriority">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1020,17 +1020,8 @@
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<!-- Dogecoin does not use smart fees, so we do not have the smart fee warning here -->
|
||||||
<widget class="QLabel" name="labelSmartFee2">
|
|
||||||
<property name="text">
|
|
||||||
<string>(Smart fee not initialized yet. This usually takes a few blocks...)</string>
|
|
||||||
</property>
|
|
||||||
<property name="margin">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_5">
|
<spacer name="horizontalSpacer_5">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -1051,9 +1042,9 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayoutFee6">
|
<layout class="QVBoxLayout" name="verticalLayoutFee6">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelSmartFee3">
|
<widget class="QLabel" name="labelPriority3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Confirmation time target:</string>
|
<string>Priority:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="margin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
|
@ -1086,7 +1077,7 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>23</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="pageStep">
|
<property name="pageStep">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
|
@ -1111,9 +1102,9 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayoutFee10">
|
<layout class="QHBoxLayout" name="horizontalLayoutFee10">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelSmartFeeNormal">
|
<widget class="QLabel" name="labelPriorityLow">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>normal</string>
|
<string>low</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -1151,9 +1142,9 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelSmartFeeFast">
|
<widget class="QLabel" name="labelPriorityHigh">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>fast</string>
|
<string>high</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "base58.h"
|
#include "base58.h"
|
||||||
#include "chainparams.h"
|
#include "chainparams.h"
|
||||||
|
#include "dogecoin-fees.h"
|
||||||
#include "wallet/coincontrol.h"
|
#include "wallet/coincontrol.h"
|
||||||
#include "validation.h" // mempool and minRelayTxFeeRate
|
#include "validation.h" // mempool and minRelayTxFeeRate
|
||||||
#include "ui_interface.h"
|
#include "ui_interface.h"
|
||||||
|
@ -100,8 +101,8 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p
|
||||||
settings.setValue("nCustomFeeRadio", 1); // total at least
|
settings.setValue("nCustomFeeRadio", 1); // total at least
|
||||||
if (!settings.contains("nCustomFeeRadio"))
|
if (!settings.contains("nCustomFeeRadio"))
|
||||||
settings.setValue("nCustomFeeRadio", 0); // per kilobyte
|
settings.setValue("nCustomFeeRadio", 0); // per kilobyte
|
||||||
if (!settings.contains("nSmartFeeSliderPosition"))
|
if (!settings.contains("nPresetFeeSliderPosition"))
|
||||||
settings.setValue("nSmartFeeSliderPosition", 0);
|
settings.setValue("nPresetFeeSliderPosition", 0);
|
||||||
if (!settings.contains("nTransactionFee"))
|
if (!settings.contains("nTransactionFee"))
|
||||||
settings.setValue("nTransactionFee", (qint64)DEFAULT_TRANSACTION_FEE);
|
settings.setValue("nTransactionFee", (qint64)DEFAULT_TRANSACTION_FEE);
|
||||||
if (!settings.contains("fPayOnlyMinFee"))
|
if (!settings.contains("fPayOnlyMinFee"))
|
||||||
|
@ -122,7 +123,7 @@ void SendCoinsDialog::setClientModel(ClientModel *_clientModel)
|
||||||
this->clientModel = _clientModel;
|
this->clientModel = _clientModel;
|
||||||
|
|
||||||
if (_clientModel) {
|
if (_clientModel) {
|
||||||
connect(_clientModel, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(updateSmartFeeLabel()));
|
connect(_clientModel, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(updateFeeLabel()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +155,7 @@ void SendCoinsDialog::setModel(WalletModel *_model)
|
||||||
coinControlUpdateLabels();
|
coinControlUpdateLabels();
|
||||||
|
|
||||||
// fee section
|
// fee section
|
||||||
connect(ui->sliderSmartFee, SIGNAL(valueChanged(int)), this, SLOT(updateSmartFeeLabel()));
|
connect(ui->sliderSmartFee, SIGNAL(valueChanged(int)), this, SLOT(updateFeeLabel()));
|
||||||
connect(ui->sliderSmartFee, SIGNAL(valueChanged(int)), this, SLOT(updateGlobalFeeVariables()));
|
connect(ui->sliderSmartFee, SIGNAL(valueChanged(int)), this, SLOT(updateGlobalFeeVariables()));
|
||||||
connect(ui->sliderSmartFee, SIGNAL(valueChanged(int)), this, SLOT(coinControlUpdateLabels()));
|
connect(ui->sliderSmartFee, SIGNAL(valueChanged(int)), this, SLOT(coinControlUpdateLabels()));
|
||||||
connect(ui->groupFee, SIGNAL(buttonClicked(int)), this, SLOT(updateFeeSectionControls()));
|
connect(ui->groupFee, SIGNAL(buttonClicked(int)), this, SLOT(updateFeeSectionControls()));
|
||||||
|
@ -171,15 +172,12 @@ void SendCoinsDialog::setModel(WalletModel *_model)
|
||||||
ui->customFee->setSingleStep(CWallet::GetRequiredFee(1000));
|
ui->customFee->setSingleStep(CWallet::GetRequiredFee(1000));
|
||||||
updateFeeSectionControls();
|
updateFeeSectionControls();
|
||||||
updateMinFeeLabel();
|
updateMinFeeLabel();
|
||||||
updateSmartFeeLabel();
|
updateFeeLabel();
|
||||||
updateGlobalFeeVariables();
|
updateGlobalFeeVariables();
|
||||||
|
|
||||||
// set the smartfee-sliders default value (wallets default conf.target or last stored value)
|
// set the smartfee-sliders default value (wallets default conf.target or last stored value)
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
if (settings.value("nSmartFeeSliderPosition").toInt() == 0)
|
ui->sliderSmartFee->setValue(settings.value("nPresetFeeSliderPosition").toInt());
|
||||||
ui->sliderSmartFee->setValue(ui->sliderSmartFee->maximum() - model->getDefaultConfirmTarget() + 2);
|
|
||||||
else
|
|
||||||
ui->sliderSmartFee->setValue(settings.value("nSmartFeeSliderPosition").toInt());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +187,7 @@ SendCoinsDialog::~SendCoinsDialog()
|
||||||
settings.setValue("fFeeSectionMinimized", fFeeMinimized);
|
settings.setValue("fFeeSectionMinimized", fFeeMinimized);
|
||||||
settings.setValue("nFeeRadio", ui->groupFee->checkedId());
|
settings.setValue("nFeeRadio", ui->groupFee->checkedId());
|
||||||
settings.setValue("nCustomFeeRadio", ui->groupCustomFee->checkedId());
|
settings.setValue("nCustomFeeRadio", ui->groupCustomFee->checkedId());
|
||||||
settings.setValue("nSmartFeeSliderPosition", ui->sliderSmartFee->value());
|
settings.setValue("nPresetFeeSliderPosition", ui->sliderSmartFee->value());
|
||||||
settings.setValue("nTransactionFee", (qint64)ui->customFee->value());
|
settings.setValue("nTransactionFee", (qint64)ui->customFee->value());
|
||||||
settings.setValue("fPayOnlyMinFee", ui->checkBoxMinimumFee->isChecked());
|
settings.setValue("fPayOnlyMinFee", ui->checkBoxMinimumFee->isChecked());
|
||||||
|
|
||||||
|
@ -243,9 +241,9 @@ void SendCoinsDialog::on_sendButton_clicked()
|
||||||
if (model->getOptionsModel()->getCoinControlFeatures())
|
if (model->getOptionsModel()->getCoinControlFeatures())
|
||||||
ctrl = *CoinControlDialog::coinControl;
|
ctrl = *CoinControlDialog::coinControl;
|
||||||
if (ui->radioSmartFee->isChecked())
|
if (ui->radioSmartFee->isChecked())
|
||||||
ctrl.nConfirmTarget = ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 2;
|
ctrl.nPriority = static_cast<FeeRatePreset>(ui->sliderSmartFee->value());
|
||||||
else
|
else
|
||||||
ctrl.nConfirmTarget = 0;
|
ctrl.nPriority = MINIMUM;
|
||||||
|
|
||||||
prepareStatus = model->prepareTransaction(currentTransaction, &ctrl);
|
prepareStatus = model->prepareTransaction(currentTransaction, &ctrl);
|
||||||
|
|
||||||
|
@ -502,7 +500,7 @@ void SendCoinsDialog::updateDisplayUnit()
|
||||||
setBalance(model->getBalance(), 0, 0, 0, 0, 0);
|
setBalance(model->getBalance(), 0, 0, 0, 0, 0);
|
||||||
ui->customFee->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
|
ui->customFee->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
|
||||||
updateMinFeeLabel();
|
updateMinFeeLabel();
|
||||||
updateSmartFeeLabel();
|
updateFeeLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg)
|
void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg)
|
||||||
|
@ -585,13 +583,13 @@ void SendCoinsDialog::setMinimumFee()
|
||||||
void SendCoinsDialog::updateFeeSectionControls()
|
void SendCoinsDialog::updateFeeSectionControls()
|
||||||
{
|
{
|
||||||
ui->sliderSmartFee ->setEnabled(ui->radioSmartFee->isChecked());
|
ui->sliderSmartFee ->setEnabled(ui->radioSmartFee->isChecked());
|
||||||
ui->labelSmartFee ->setEnabled(ui->radioSmartFee->isChecked());
|
ui->labelPriority ->setEnabled(ui->radioSmartFee->isChecked());
|
||||||
ui->labelSmartFee2 ->setEnabled(ui->radioSmartFee->isChecked());
|
// Dogecoin: We don't use smart fees in the UI, so don't need to warn they're not available
|
||||||
ui->labelSmartFee3 ->setEnabled(ui->radioSmartFee->isChecked());
|
// ui->labelPriority2 ->setEnabled(ui->radioSmartFee->isChecked());
|
||||||
|
ui->labelPriority3 ->setEnabled(ui->radioSmartFee->isChecked());
|
||||||
ui->labelFeeEstimation ->setEnabled(ui->radioSmartFee->isChecked());
|
ui->labelFeeEstimation ->setEnabled(ui->radioSmartFee->isChecked());
|
||||||
ui->labelSmartFeeNormal ->setEnabled(ui->radioSmartFee->isChecked());
|
ui->labelPriorityLow ->setEnabled(ui->radioSmartFee->isChecked());
|
||||||
ui->labelSmartFeeFast ->setEnabled(ui->radioSmartFee->isChecked());
|
ui->labelPriorityHigh ->setEnabled(ui->radioSmartFee->isChecked());
|
||||||
//mlumin: 5/2021 - this label actually gates the 'slider and smart fee' functionality, so turn it off for dogecoin.
|
|
||||||
ui->confirmationTargetLabel ->setEnabled(ui->radioSmartFee->isChecked());
|
ui->confirmationTargetLabel ->setEnabled(ui->radioSmartFee->isChecked());
|
||||||
ui->checkBoxMinimumFee ->setEnabled(ui->radioCustomFee->isChecked());
|
ui->checkBoxMinimumFee ->setEnabled(ui->radioCustomFee->isChecked());
|
||||||
ui->labelMinFeeWarning ->setEnabled(ui->radioCustomFee->isChecked());
|
ui->labelMinFeeWarning ->setEnabled(ui->radioCustomFee->isChecked());
|
||||||
|
@ -604,7 +602,7 @@ void SendCoinsDialog::updateGlobalFeeVariables()
|
||||||
{
|
{
|
||||||
if (ui->radioSmartFee->isChecked())
|
if (ui->radioSmartFee->isChecked())
|
||||||
{
|
{
|
||||||
int nConfirmTarget = ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 2;
|
int nPriority = ui->sliderSmartFee->value();
|
||||||
payTxFee = CFeeRate(0);
|
payTxFee = CFeeRate(0);
|
||||||
|
|
||||||
// set nMinimumTotalFee to 0 to not accidentally pay a custom fee
|
// set nMinimumTotalFee to 0 to not accidentally pay a custom fee
|
||||||
|
@ -612,7 +610,7 @@ void SendCoinsDialog::updateGlobalFeeVariables()
|
||||||
|
|
||||||
// show the estimated required time for confirmation
|
// show the estimated required time for confirmation
|
||||||
// Dogecoin: We manually set height well past the last hard fork here
|
// Dogecoin: We manually set height well past the last hard fork here
|
||||||
ui->confirmationTargetLabel->setText(GUIUtil::formatDurationStr(nConfirmTarget * Params().GetConsensus(400000).nPowTargetSpacing) + " / " + tr("%n block(s)", "", nConfirmTarget));
|
ui->confirmationTargetLabel->setText(GetDogecoinPriorityLabel(nPriority).c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -630,7 +628,7 @@ void SendCoinsDialog::updateFeeMinimizedLabel()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ui->radioSmartFee->isChecked())
|
if (ui->radioSmartFee->isChecked())
|
||||||
ui->labelFeeMinimized->setText(ui->labelSmartFee->text());
|
ui->labelFeeMinimized->setText(ui->labelPriority->text());
|
||||||
else {
|
else {
|
||||||
ui->labelFeeMinimized->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), ui->customFee->value()) +
|
ui->labelFeeMinimized->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), ui->customFee->value()) +
|
||||||
((ui->radioCustomPerKilobyte->isChecked()) ? "/kB" : ""));
|
((ui->radioCustomPerKilobyte->isChecked()) ? "/kB" : ""));
|
||||||
|
@ -645,19 +643,18 @@ void SendCoinsDialog::updateMinFeeLabel()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendCoinsDialog::updateSmartFeeLabel()
|
void SendCoinsDialog::updateFeeLabel()
|
||||||
{
|
{
|
||||||
if(!model || !model->getOptionsModel())
|
if(!model || !model->getOptionsModel())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int nBlocksToConfirm = ui->sliderSmartFee->maximum() - ui->sliderSmartFee->value() + 2;
|
int nPriority = ui->sliderSmartFee->value();
|
||||||
int estimateFoundAtBlocks = nBlocksToConfirm;
|
CFeeRate feeRate = GetDogecoinFeeRate(nPriority);
|
||||||
CFeeRate feeRate = mempool.estimateSmartFee(nBlocksToConfirm, &estimateFoundAtBlocks);
|
|
||||||
if (feeRate <= CFeeRate(0)) // not enough data => minfee
|
if (feeRate <= CFeeRate(0)) // not enough data => minfee
|
||||||
{
|
{
|
||||||
ui->labelSmartFee->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(),
|
ui->labelPriority->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(),
|
||||||
std::max(CWallet::fallbackFee.GetFeePerK(), CWallet::GetRequiredFee(1000))) + "/kB");
|
std::max(CWallet::fallbackFee.GetFeePerK(), CWallet::GetRequiredFee(1000))) + "/kB");
|
||||||
ui->labelSmartFee2->show(); // (Smart fee not initialized yet. This usually takes a few blocks...)
|
// ui->labelPriority2->show(); // (Smart fee not initialized yet. This usually takes a few blocks...)
|
||||||
ui->labelFeeEstimation->setText("");
|
ui->labelFeeEstimation->setText("");
|
||||||
ui->fallbackFeeWarningLabel->setVisible(true);
|
ui->fallbackFeeWarningLabel->setVisible(true);
|
||||||
int lightness = ui->fallbackFeeWarningLabel->palette().color(QPalette::WindowText).lightness();
|
int lightness = ui->fallbackFeeWarningLabel->palette().color(QPalette::WindowText).lightness();
|
||||||
|
@ -667,10 +664,12 @@ void SendCoinsDialog::updateSmartFeeLabel()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->labelSmartFee->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(),
|
ui->labelPriority->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(),
|
||||||
std::max(feeRate.GetFeePerK(), CWallet::GetRequiredFee(1000))) + "/kB");
|
std::max(feeRate.GetFeePerK(), CWallet::GetRequiredFee(1000))) + "/kB");
|
||||||
ui->labelSmartFee2->hide();
|
// ui->labelPriority2->hide();
|
||||||
ui->labelFeeEstimation->setText(tr("Estimated to begin confirmation within %n block(s).", "", estimateFoundAtBlocks));
|
// Dogecoin: We don't use smart fees, so we don't have the data to estimate when it will get in
|
||||||
|
ui->labelFeeEstimation->setText("");
|
||||||
|
// ui->labelFeeEstimation->setText(tr("Estimated to begin confirmation within %n block(s).", "", estimateFoundAtBlocks));
|
||||||
ui->fallbackFeeWarningLabel->setVisible(false);
|
ui->fallbackFeeWarningLabel->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ private Q_SLOTS:
|
||||||
void setMinimumFee();
|
void setMinimumFee();
|
||||||
void updateFeeSectionControls();
|
void updateFeeSectionControls();
|
||||||
void updateMinFeeLabel();
|
void updateMinFeeLabel();
|
||||||
void updateSmartFeeLabel();
|
void updateFeeLabel();
|
||||||
void updateGlobalFeeVariables();
|
void updateGlobalFeeVariables();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define BITCOIN_WALLET_COINCONTROL_H
|
#define BITCOIN_WALLET_COINCONTROL_H
|
||||||
|
|
||||||
#include "primitives/transaction.h"
|
#include "primitives/transaction.h"
|
||||||
|
#include "dogecoin-fees.h"
|
||||||
|
|
||||||
/** Coin Control Features. */
|
/** Coin Control Features. */
|
||||||
class CCoinControl
|
class CCoinControl
|
||||||
|
@ -22,8 +23,8 @@ public:
|
||||||
bool fOverrideFeeRate;
|
bool fOverrideFeeRate;
|
||||||
//! Feerate to use if overrideFeeRate is true
|
//! Feerate to use if overrideFeeRate is true
|
||||||
CFeeRate nFeeRate;
|
CFeeRate nFeeRate;
|
||||||
//! Override the default confirmation target, 0 = use default
|
//! Override the default transaction speed, 0 = use default
|
||||||
int nConfirmTarget;
|
FeeRatePreset nPriority;
|
||||||
|
|
||||||
CCoinControl()
|
CCoinControl()
|
||||||
{
|
{
|
||||||
|
@ -39,7 +40,7 @@ public:
|
||||||
nMinimumTotalFee = 0;
|
nMinimumTotalFee = 0;
|
||||||
nFeeRate = CFeeRate(0);
|
nFeeRate = CFeeRate(0);
|
||||||
fOverrideFeeRate = false;
|
fOverrideFeeRate = false;
|
||||||
nConfirmTarget = 0;
|
nPriority = MINIMUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasSelected() const
|
bool HasSelected() const
|
||||||
|
|
|
@ -39,8 +39,6 @@ using namespace std;
|
||||||
CWallet* pwalletMain = NULL;
|
CWallet* pwalletMain = NULL;
|
||||||
/** Transaction fee set by the user */
|
/** Transaction fee set by the user */
|
||||||
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE);
|
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE);
|
||||||
//mlumin 5/2021: Add minimum wallet tx fee. This really should be expressed as a rate not a final fee.
|
|
||||||
CFeeRate minWalletTxFeeRate = CFeeRate(DEFAULT_MIN_WALLET_TX_FEE);
|
|
||||||
unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET;
|
unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET;
|
||||||
bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE;
|
bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE;
|
||||||
bool fSendFreeTransactions = DEFAULT_SEND_FREE_TRANSACTIONS;
|
bool fSendFreeTransactions = DEFAULT_SEND_FREE_TRANSACTIONS;
|
||||||
|
@ -2661,8 +2659,11 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||||
|
|
||||||
// Allow to override the default confirmation target over the CoinControl instance
|
// Allow to override the default confirmation target over the CoinControl instance
|
||||||
int currentConfirmationTarget = nTxConfirmTarget;
|
int currentConfirmationTarget = nTxConfirmTarget;
|
||||||
if (coinControl && coinControl->nConfirmTarget > 0)
|
FeeRatePreset nPriority;
|
||||||
currentConfirmationTarget = coinControl->nConfirmTarget;
|
if (coinControl && coinControl->nPriority > 0)
|
||||||
|
nPriority = coinControl->nPriority;
|
||||||
|
else
|
||||||
|
nPriority = MINIMUM;
|
||||||
|
|
||||||
// Can we complete this as a free transaction?
|
// Can we complete this as a free transaction?
|
||||||
if (fSendFreeTransactions && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE)
|
if (fSendFreeTransactions && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE)
|
||||||
|
@ -2674,7 +2675,13 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CAmount nFeeNeeded = GetMinimumFee(txNew, nBytes, currentConfirmationTarget, mempool);
|
CAmount nFeeNeeded;
|
||||||
|
if (nPriority == MINIMUM) {
|
||||||
|
nFeeNeeded = GetMinimumFee(txNew, nBytes, currentConfirmationTarget, mempool);
|
||||||
|
} else {
|
||||||
|
// Force the fee rate higher
|
||||||
|
nFeeNeeded = GetDogecoinPriorityFee(txNew, nBytes, nPriority);
|
||||||
|
}
|
||||||
if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) {
|
if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) {
|
||||||
nFeeNeeded = coinControl->nMinimumTotalFee;
|
nFeeNeeded = coinControl->nMinimumTotalFee;
|
||||||
}
|
}
|
||||||
|
@ -2887,6 +2894,31 @@ CAmount CWallet::GetMinimumFee(const CMutableTransaction& tx, unsigned int nTxBy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CAmount CWallet::GetDogecoinPriorityFee(const CMutableTransaction& tx, unsigned int nTxBytes, FeeRatePreset nPriority)
|
||||||
|
{
|
||||||
|
// payTxFee is the user-set global for desired feerate
|
||||||
|
return GetDogecoinPriorityFee(tx, nTxBytes, nPriority, payTxFee.GetFee(nTxBytes));
|
||||||
|
}
|
||||||
|
CAmount CWallet::GetDogecoinPriorityFee(const CMutableTransaction& tx, unsigned int nTxBytes, FeeRatePreset nPriority, CAmount targetFee)
|
||||||
|
{
|
||||||
|
CAmount nFeeNeeded = targetFee;
|
||||||
|
// User didn't set: use -txconfirmtarget to estimate...
|
||||||
|
if (nFeeNeeded == 0) {
|
||||||
|
nFeeNeeded = GetDogecoinFeeRate(nPriority).GetFee(nTxBytes);
|
||||||
|
}
|
||||||
|
// prevent user from paying a fee below minRelayTxFee or minTxFee
|
||||||
|
// Dogecoin: as we're adapting minTxFee to never be higher than
|
||||||
|
// payTxFee unless explicitly set, this should be fine
|
||||||
|
nFeeNeeded = std::max(nFeeNeeded, GetRequiredFee(tx, nTxBytes));
|
||||||
|
|
||||||
|
// But always obey the maximum
|
||||||
|
if (nFeeNeeded > maxTxFee)
|
||||||
|
nFeeNeeded = maxTxFee;
|
||||||
|
|
||||||
|
return nFeeNeeded;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
|
DBErrors CWallet::LoadWallet(bool& fFirstRunRet)
|
||||||
{
|
{
|
||||||
if (!fFileBacked)
|
if (!fFileBacked)
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "amount.h"
|
#include "amount.h"
|
||||||
#include "auxpow.h"
|
#include "auxpow.h"
|
||||||
|
#include "dogecoin-fees.h"
|
||||||
#include "streams.h"
|
#include "streams.h"
|
||||||
#include "tinyformat.h"
|
#include "tinyformat.h"
|
||||||
#include "ui_interface.h"
|
#include "ui_interface.h"
|
||||||
|
@ -54,8 +55,6 @@ static const CAmount DEFAULT_TRANSACTION_FEE = COIN / 100;
|
||||||
static const CAmount DEFAULT_FALLBACK_FEE = COIN / 100;
|
static const CAmount DEFAULT_FALLBACK_FEE = COIN / 100;
|
||||||
//! -mintxfee default
|
//! -mintxfee default
|
||||||
static const CAmount DEFAULT_TRANSACTION_MINFEE = COIN / 100;
|
static const CAmount DEFAULT_TRANSACTION_MINFEE = COIN / 100;
|
||||||
//mlumin 5/2021: adding a minimum Wallet fee vs relay, currently still 1 COIN, to be reduced.
|
|
||||||
static const CAmount DEFAULT_MIN_WALLET_TX_FEE = COIN / 100;
|
|
||||||
//! minimum recommended increment for BIP 125 replacement txs
|
//! minimum recommended increment for BIP 125 replacement txs
|
||||||
static const CAmount WALLET_INCREMENTAL_RELAY_FEE = COIN/10 * 5;
|
static const CAmount WALLET_INCREMENTAL_RELAY_FEE = COIN/10 * 5;
|
||||||
//! target minimum change amount
|
//! target minimum change amount
|
||||||
|
@ -761,6 +760,14 @@ public:
|
||||||
* then fee estimation for nConfirmTarget
|
* then fee estimation for nConfirmTarget
|
||||||
*/
|
*/
|
||||||
static CAmount GetMinimumFee(const CMutableTransaction& tx, unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, CAmount targetFee);
|
static CAmount GetMinimumFee(const CMutableTransaction& tx, unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool& pool, CAmount targetFee);
|
||||||
|
/**
|
||||||
|
* Dogecoin: Get a fee targetting a specific transaction speed.
|
||||||
|
*/
|
||||||
|
CAmount GetDogecoinPriorityFee(const CMutableTransaction& tx, unsigned int nTxBytes, FeeRatePreset nSpeed);
|
||||||
|
/**
|
||||||
|
* Dogecoin: Get a fee targetting a specific transaction speed.
|
||||||
|
*/
|
||||||
|
static CAmount GetDogecoinPriorityFee(const CMutableTransaction& tx, unsigned int nTxBytes, FeeRatePreset nSpeed, CAmount targetFee);
|
||||||
/**
|
/**
|
||||||
* Return the minimum required fee taking into account the
|
* Return the minimum required fee taking into account the
|
||||||
* floating relay fee and user set minimum transaction fee
|
* floating relay fee and user set minimum transaction fee
|
||||||
|
|
Loading…
Reference in a new issue