Browse Source

Merge pull request #4465

d88af56 Fee fixes (Cozz Lovan)
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
7d05645693
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 7
      src/core.cpp
  2. 1
      src/init.cpp
  3. 12
      src/qt/coincontroldialog.cpp
  4. 2
      src/wallet.cpp

7
src/core.cpp

@ -82,7 +82,12 @@ CFeeRate::CFeeRate(int64_t nFeePaid, size_t nSize)
int64_t CFeeRate::GetFee(size_t nSize) const int64_t CFeeRate::GetFee(size_t nSize) const
{ {
return nSatoshisPerK*nSize / 1000; int64_t nFee = nSatoshisPerK*nSize / 1000;
if (nFee == 0 && nSatoshisPerK > 0)
nFee = nSatoshisPerK;
return nFee;
} }
std::string CFeeRate::ToString() const std::string CFeeRate::ToString() const

1
src/init.cpp

@ -253,6 +253,7 @@ std::string HelpMessage(HelpMessageMode mode)
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
strUsage += "\n" + _("Wallet options:") + "\n"; strUsage += "\n" + _("Wallet options:") + "\n";
strUsage += " -disablewallet " + _("Do not load the wallet and disable wallet RPC calls") + "\n"; strUsage += " -disablewallet " + _("Do not load the wallet and disable wallet RPC calls") + "\n";
if (GetBoolArg("-help-debug", false))
strUsage += " -mintxfee=<amt> " + strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for transaction creation (default: %s)"), FormatMoney(CWallet::minTxFee.GetFeePerK())) + "\n"; strUsage += " -mintxfee=<amt> " + strprintf(_("Fees (in BTC/Kb) smaller than this are considered zero fee for transaction creation (default: %s)"), FormatMoney(CWallet::minTxFee.GetFeePerK())) + "\n";
strUsage += " -paytxfee=<amt> " + strprintf(_("Fee (in BTC/kB) to add to transactions you send (default: %s)"), FormatMoney(payTxFee.GetFeePerK())) + "\n"; strUsage += " -paytxfee=<amt> " + strprintf(_("Fee (in BTC/kB) to add to transactions you send (default: %s)"), FormatMoney(payTxFee.GetFeePerK())) + "\n";
strUsage += " -rescan " + _("Rescan the block chain for missing wallet transactions") + " " + _("on startup") + "\n"; strUsage += " -rescan " + _("Rescan the block chain for missing wallet transactions") + " " + _("on startup") + "\n";

12
src/qt/coincontroldialog.cpp

@ -419,6 +419,8 @@ QString CoinControlDialog::getPriorityLabel(const CTxMemPool& pool, double dPrio
} }
// Note: if mempool hasn't accumulated enough history (estimatePriority // Note: if mempool hasn't accumulated enough history (estimatePriority
// returns -1) we're conservative and classify as "lowest" // returns -1) we're conservative and classify as "lowest"
if (mempool.estimatePriority(nTxConfirmTarget) <= 0 && AllowFree(dPriority))
return ">=" + tr("medium");
return tr("lowest"); return tr("lowest");
} }
@ -523,15 +525,21 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
dPriority = dPriorityInputs / (nBytes - nBytesInputs + (nQuantityUncompressed * 29)); // 29 = 180 - 151 (uncompressed public keys are over the limit. max 151 bytes of the input are ignored for priority) dPriority = dPriorityInputs / (nBytes - nBytesInputs + (nQuantityUncompressed * 29)); // 29 = 180 - 151 (uncompressed public keys are over the limit. max 151 bytes of the input are ignored for priority)
sPriorityLabel = CoinControlDialog::getPriorityLabel(mempool, dPriority); sPriorityLabel = CoinControlDialog::getPriorityLabel(mempool, dPriority);
// Voluntary Fee
nPayFee = payTxFee.GetFee(max((unsigned int)1000, nBytes));
// Min Fee // Min Fee
if (nPayFee == 0)
{
nPayFee = CWallet::GetMinimumFee(nBytes, nTxConfirmTarget, mempool); nPayFee = CWallet::GetMinimumFee(nBytes, nTxConfirmTarget, mempool);
double dPriorityNeeded = mempool.estimatePriority(nTxConfirmTarget); double dPriorityNeeded = mempool.estimatePriority(nTxConfirmTarget);
if (dPriorityNeeded <= 0) // Not enough mempool history: never send free if (dPriorityNeeded <= 0 && !AllowFree(dPriority)) // not enough mempool history: never send free
dPriorityNeeded = std::numeric_limits<double>::max(); dPriorityNeeded = std::numeric_limits<double>::max();
if (nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE && dPriority >= dPriorityNeeded) if (nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE && dPriority >= dPriorityNeeded)
nPayFee = 0; nPayFee = 0;
}
if (nPayAmount > 0) if (nPayAmount > 0)
{ {
@ -612,7 +620,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
QString toolTip3 = tr("This label turns red, if any recipient receives an amount smaller than %1.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, ::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 // how many satoshis the estimated fee can vary per byte we guess wrong
double dFeeVary = (double)std::max(CWallet::minTxFee.GetFeePerK(), payTxFee.GetFeePerK()) / 1000; double dFeeVary = (double)std::max(CWallet::minTxFee.GetFeePerK(), std::max(payTxFee.GetFeePerK(), mempool.estimateFee(nTxConfirmTarget).GetFeePerK())) / 1000;
QString toolTip4 = tr("Can vary +/- %1 satoshi(s) per input.").arg(dFeeVary); QString toolTip4 = tr("Can vary +/- %1 satoshi(s) per input.").arg(dFeeVary);
l3->setToolTip(toolTip4); l3->setToolTip(toolTip4);

2
src/wallet.cpp

@ -1484,7 +1484,7 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend,
break; break;
// Small enough, and priority high enough, to send for free // Small enough, and priority high enough, to send for free
if (dPriority >= dPriorityNeeded) if (dPriorityNeeded > 0 && dPriority >= dPriorityNeeded)
break; break;
// Include more fee and try again. // Include more fee and try again.

Loading…
Cancel
Save