Move fee policy out of core
This commit is contained in:
@@ -406,7 +406,7 @@ QString CoinControlDialog::getPriorityLabel(const CTxMemPool& pool, double dPrio
|
||||
{
|
||||
// confirmations -> textual description
|
||||
typedef std::map<unsigned int, QString> PriorityDescription;
|
||||
static PriorityDescription priorityDescriptions = boost::assign::map_list_of
|
||||
const static PriorityDescription priorityDescriptions = boost::assign::map_list_of
|
||||
(1, tr("highest"))(2, tr("higher"))(3, tr("high"))
|
||||
(5, tr("medium-high"))(6, tr("medium"))
|
||||
(10, tr("low-medium"))(15, tr("low"))
|
||||
@@ -452,7 +452,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||
{
|
||||
CTxOut txout(amount, (CScript)vector<unsigned char>(24, 0));
|
||||
txDummy.vout.push_back(txout);
|
||||
if (txout.IsDust(CTransaction::minRelayTxFee))
|
||||
if (txout.IsDust(::minRelayTxFee))
|
||||
fDust = true;
|
||||
}
|
||||
}
|
||||
@@ -544,7 +544,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||
if (nChange > 0 && nChange < CENT)
|
||||
{
|
||||
CTxOut txout(nChange, (CScript)vector<unsigned char>(24, 0));
|
||||
if (txout.IsDust(CTransaction::minRelayTxFee))
|
||||
if (txout.IsDust(::minRelayTxFee))
|
||||
{
|
||||
nPayFee += nChange;
|
||||
nChange = 0;
|
||||
@@ -605,17 +605,17 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||
|
||||
// tool tips
|
||||
QString toolTip1 = tr("This label turns red, if the transaction size is greater than 1000 bytes.") + "<br /><br />";
|
||||
toolTip1 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::minTxFee.GetFeePerK())) + "<br /><br />";
|
||||
toolTip1 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CWallet::minTxFee.GetFeePerK())) + "<br /><br />";
|
||||
toolTip1 += tr("Can vary +/- 1 byte per input.");
|
||||
|
||||
QString toolTip2 = tr("Transactions with higher priority are more likely to get included into a block.") + "<br /><br />";
|
||||
toolTip2 += tr("This label turns red, if the priority is smaller than \"medium\".") + "<br /><br />";
|
||||
toolTip2 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::minTxFee.GetFeePerK()));
|
||||
toolTip2 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CWallet::minTxFee.GetFeePerK()));
|
||||
|
||||
QString toolTip3 = tr("This label turns red, if any recipient receives an amount smaller than %1.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::minRelayTxFee.GetFee(546)));
|
||||
QString toolTip3 = tr("This label turns red, if any recipient receives an amount smaller than %1.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, ::minRelayTxFee.GetFee(546)));
|
||||
|
||||
// how many satoshis the estimated fee can vary per byte we guess wrong
|
||||
double dFeeVary = (double)std::max(CTransaction::minTxFee.GetFeePerK(), payTxFee.GetFeePerK()) / 1000;
|
||||
double dFeeVary = (double)std::max(CWallet::minTxFee.GetFeePerK(), payTxFee.GetFeePerK()) / 1000;
|
||||
QString toolTip4 = tr("Can vary +/- %1 satoshi(s) per input.").arg(dFeeVary);
|
||||
|
||||
l3->setToolTip(toolTip4);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "core.h"
|
||||
#include "init.h"
|
||||
#include "main.h"
|
||||
#include "protocol.h"
|
||||
#include "util.h"
|
||||
|
||||
@@ -212,7 +213,7 @@ bool isDust(const QString& address, qint64 amount)
|
||||
CTxDestination dest = CBitcoinAddress(address.toStdString()).Get();
|
||||
CScript script; script.SetDestination(dest);
|
||||
CTxOut txOut(amount, script);
|
||||
return txOut.IsDust(CTransaction::minRelayTxFee);
|
||||
return txOut.IsDust(::minRelayTxFee);
|
||||
}
|
||||
|
||||
QString HtmlEscape(const QString& str, bool fMultiLine)
|
||||
|
||||
@@ -14,7 +14,10 @@
|
||||
#include "monitoreddatamapper.h"
|
||||
#include "optionsmodel.h"
|
||||
|
||||
#include "main.h" // for CTransaction::minTxFee and MAX_SCRIPTCHECK_THREADS
|
||||
#include "main.h" // for MAX_SCRIPTCHECK_THREADS
|
||||
#ifdef ENABLE_WALLET
|
||||
#include "wallet.h" // for CWallet::minTxFee
|
||||
#endif
|
||||
#include "netbase.h"
|
||||
#include "txdb.h" // for -dbcache defaults
|
||||
|
||||
@@ -101,7 +104,9 @@ OptionsDialog::OptionsDialog(QWidget *parent) :
|
||||
#endif
|
||||
|
||||
ui->unit->setModel(new BitcoinUnits(this));
|
||||
ui->transactionFee->setSingleStep(CTransaction::minTxFee.GetFeePerK());
|
||||
#ifdef ENABLE_WALLET
|
||||
ui->transactionFee->setSingleStep(CWallet::minTxFee.GetFeePerK());
|
||||
#endif
|
||||
|
||||
/* Widget-to-option mapper */
|
||||
mapper = new MonitoredDataMapper(this);
|
||||
|
||||
@@ -551,7 +551,7 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoins
|
||||
|
||||
// Extract and check amounts
|
||||
CTxOut txOut(sendingTo.second, sendingTo.first);
|
||||
if (txOut.IsDust(CTransaction::minRelayTxFee)) {
|
||||
if (txOut.IsDust(::minRelayTxFee)) {
|
||||
emit message(tr("Payment request error"), tr("Requested payment amount of %1 is too small (considered dust).")
|
||||
.arg(BitcoinUnits::formatWithUnit(optionsModel->getDisplayUnit(), sendingTo.second)),
|
||||
CClientUIInterface::MSG_ERROR);
|
||||
|
||||
Reference in New Issue
Block a user