diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -638,16 +638,8 @@ "than the current dust threshold."); // how many satoshis the estimated fee can vary per byte we guess wrong - double dFeeVary; - if (payTxFee.GetFeePerK() > Amount::zero()) { - dFeeVary = std::max(GetRequiredFee(1000), payTxFee.GetFeePerK()) / - (1000 * SATOSHI); - } else { - dFeeVary = - std::max(GetRequiredFee(1000), - mempool.estimateSmartFee(nTxConfirmTarget).GetFeePerK()) / - (1000 * SATOSHI); - } + double dFeeVary = GetMinimumFee(1000, 2, mempool) / (1000 * SATOSHI); + QString toolTip4 = tr("Can vary +/- %1 satoshi(s) per input.").arg(dFeeVary); diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -221,7 +221,8 @@ SLOT(updateGlobalFeeVariables())); connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels())); - ui->customFee->setSingleStep(GetRequiredFee(1000)); + + ui->customFee->setSingleStep(GetMinimumFee(1000, 2, mempool)); updateFeeSectionControls(); updateMinFeeLabel(); updateSmartFeeLabel(); @@ -664,7 +665,7 @@ void SendCoinsDialog::setMinimumFee() { ui->radioCustomPerKilobyte->setChecked(true); - ui->customFee->setValue(GetRequiredFee(1000)); + ui->customFee->setValue(GetMinimumFee(1000, 2, mempool)); } void SendCoinsDialog::updateFeeSectionControls() { @@ -737,7 +738,7 @@ tr("Pay only the required fee of %1") .arg(BitcoinUnits::formatWithUnit( model->getOptionsModel()->getDisplayUnit(), - GetRequiredFee(1000)) + + GetMinimumFee(1000, 2, mempool)) + "/kB")); } @@ -755,7 +756,7 @@ BitcoinUnits::formatWithUnit( model->getOptionsModel()->getDisplayUnit(), std::max(CWallet::fallbackFee.GetFeePerK(), - GetRequiredFee(1000))) + + GetMinimumFee(1000, 2, mempool))) + "/kB"); // (Smart fee not initialized yet. This usually takes a few blocks...) ui->labelSmartFee2->show(); @@ -764,7 +765,8 @@ ui->labelSmartFee->setText( BitcoinUnits::formatWithUnit( model->getOptionsModel()->getDisplayUnit(), - std::max(feeRate.GetFeePerK(), GetRequiredFee(1000))) + + std::max(feeRate.GetFeePerK(), + GetMinimumFee(1000, 2, mempool))) + "/kB"); ui->labelSmartFee2->hide(); ui->labelFeeEstimation->setText( diff --git a/src/wallet/fees.h b/src/wallet/fees.h --- a/src/wallet/fees.h +++ b/src/wallet/fees.h @@ -15,12 +15,6 @@ class CTxMemPool; struct FeeCalculation; -/** - * Return the minimum required fee taking into account the - * floating relay fee and user set minimum transaction fee - */ -Amount GetRequiredFee(unsigned int nTxBytes); - /** * Estimate the minimum fee considering user set parameters * and the required fee diff --git a/src/wallet/fees.cpp b/src/wallet/fees.cpp --- a/src/wallet/fees.cpp +++ b/src/wallet/fees.cpp @@ -13,11 +13,6 @@ #include "wallet/coincontrol.h" #include "wallet/wallet.h" -Amount GetRequiredFee(unsigned int nTxBytes) { - return std::max(CWallet::minTxFee.GetFee(nTxBytes), - GetConfig().GetMinFeePerKB().GetFee(nTxBytes)); -} - Amount GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarget, const CTxMemPool &pool, Amount targetFee) { Amount nFeeNeeded = targetFee; @@ -34,7 +29,8 @@ } // Prevent user from paying a fee below minRelayTxFee or minTxFee. - nFeeNeeded = std::max(nFeeNeeded, GetRequiredFee(nTxBytes)); + nFeeNeeded = + std::max(nFeeNeeded, GetConfig().GetMinFeePerKB().GetFee(nTxBytes)); // But always obey the maximum. if (nFeeNeeded > maxTxFee) { diff --git a/src/wallet/init.cpp b/src/wallet/init.cpp --- a/src/wallet/init.cpp +++ b/src/wallet/init.cpp @@ -26,11 +26,6 @@ strprintf(_("A fee rate (in %s/kB) that will be used when fee " "estimation has insufficient data (default: %s)"), CURRENCY_UNIT, FormatMoney(DEFAULT_FALLBACK_FEE))); - strUsage += HelpMessageOpt( - "-mintxfee=", - strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee " - "for transaction creation (default: %s)"), - CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MINFEE))); strUsage += HelpMessageOpt( "-paytxfee=", strprintf( @@ -185,23 +180,6 @@ _("The wallet will avoid paying less than the minimum relay fee.")); } - if (gArgs.IsArgSet("-mintxfee")) { - Amount n = Amount::zero(); - auto parsed = ParseMoney(gArgs.GetArg("-mintxfee", ""), n); - if (!parsed || Amount::zero() == n) { - return InitError( - AmountErrMsg("mintxfee", gArgs.GetArg("-mintxfee", ""))); - } - - if (n > HIGH_TX_FEE_PER_KB) { - InitWarning(AmountHighWarn("-mintxfee") + " " + - _("This is the minimum transaction fee you pay on " - "every transaction.")); - } - - CWallet::minTxFee = CFeeRate(n); - } - if (gArgs.IsArgSet("-fallbackfee")) { Amount nFeePerK = Amount::zero(); if (!ParseMoney(gArgs.GetArg("-fallbackfee", ""), nFeePerK)) { diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -46,8 +46,6 @@ static const Amount DEFAULT_TRANSACTION_FEE = Amount::zero(); //! -fallbackfee default static const Amount DEFAULT_FALLBACK_FEE(20000 * SATOSHI); -//! -mintxfee default -static const Amount DEFAULT_TRANSACTION_MINFEE(1000 * SATOSHI); //! minimum recommended increment for BIP 125 replacement txs static const Amount WALLET_INCREMENTAL_RELAY_FEE(5000 * SATOSHI); //! target minimum change amount @@ -952,7 +950,6 @@ template bool DummySignTx(CMutableTransaction &txNew, const ContainerType &coins); - static CFeeRate minTxFee; static CFeeRate fallbackFee; bool NewKeyPool(); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -47,13 +47,6 @@ const char *DEFAULT_WALLET_DAT = "wallet.dat"; const uint32_t BIP32_HARDENED_KEY_LIMIT = 0x80000000; -/** - * Fees smaller than this (in satoshi) are considered zero fee (for transaction - * creation) - * Override with -mintxfee - */ -CFeeRate CWallet::minTxFee = CFeeRate(DEFAULT_TRANSACTION_MINFEE); - /** * If fee estimation does not have enough data to provide estimates, use this * fee instead. Has no effect if not using fee estimation.