aboutsummaryrefslogtreecommitdiff
path: root/src/qt/coincontroldialog.cpp
diff options
context:
space:
mode:
authorCozz Lovan <cozzlovan@yahoo.com>2014-07-05 07:30:06 +0200
committerCozz Lovan <cozzlovan@yahoo.com>2014-07-08 05:09:19 +0200
commitd88af560111863c3e9c1ae855dcc287f04dffb02 (patch)
tree2dead75696e53fd1804f5fe478506e34da625f76 /src/qt/coincontroldialog.cpp
parent1fedd65fcf9ac04b70f0fa8cf6caa9629857d586 (diff)
downloadbitcoin-d88af560111863c3e9c1ae855dcc287f04dffb02.tar.xz
Fee fixes
Diffstat (limited to 'src/qt/coincontroldialog.cpp')
-rw-r--r--src/qt/coincontroldialog.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp
index c73cf416a8..b4ddda3eaa 100644
--- a/src/qt/coincontroldialog.cpp
+++ b/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
// returns -1) we're conservative and classify as "lowest"
+ if (mempool.estimatePriority(nTxConfirmTarget) <= 0 && AllowFree(dPriority))
+ return ">=" + tr("medium");
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)
sPriorityLabel = CoinControlDialog::getPriorityLabel(mempool, dPriority);
+ // Voluntary Fee
+ nPayFee = payTxFee.GetFee(max((unsigned int)1000, nBytes));
+
// Min Fee
- nPayFee = CWallet::GetMinimumFee(nBytes, nTxConfirmTarget, mempool);
+ if (nPayFee == 0)
+ {
+ nPayFee = CWallet::GetMinimumFee(nBytes, nTxConfirmTarget, mempool);
- double dPriorityNeeded = mempool.estimatePriority(nTxConfirmTarget);
- if (dPriorityNeeded <= 0) // Not enough mempool history: never send free
- dPriorityNeeded = std::numeric_limits<double>::max();
+ double dPriorityNeeded = mempool.estimatePriority(nTxConfirmTarget);
+ if (dPriorityNeeded <= 0 && !AllowFree(dPriority)) // not enough mempool history: never send free
+ dPriorityNeeded = std::numeric_limits<double>::max();
- if (nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE && dPriority >= dPriorityNeeded)
- nPayFee = 0;
+ if (nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE && dPriority >= dPriorityNeeded)
+ nPayFee = 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)));
// 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);
l3->setToolTip(toolTip4);