From 72b4e39c092b03abc5495b908f671b2ca8fe03cd Mon Sep 17 00:00:00 2001 From: Warren Togami Date: Wed, 23 Oct 2013 19:58:53 -1000 Subject: [PATCH] Litecoin: Adjust Coin Control for 0.8.5 for Litecoin Display the correct fee including the per output sub-CENT dust penalty. --- src/qt/coincontroldialog.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 365054b8b..bc51e9165 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -420,6 +420,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) qint64 nPayAmount = 0; bool fLowOutput = false; bool fDust = false; + unsigned int nQuantityDust = 0; CTransaction txDummy; foreach(const qint64 &amount, CoinControlDialog::payAmounts) { @@ -427,8 +428,10 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) if (amount > 0) { - if (amount < CENT) + if (amount < CENT) { fLowOutput = true; + nQuantityDust++; + } CTxOut txout(amount, (CScript)vector(24, 0)); txDummy.vout.push_back(txout); @@ -501,7 +504,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) int64 nFee = nTransactionFee * (1 + (int64)nBytes / 1000); // Min Fee - int64 nMinFee = CTransaction::nMinTxFee * (1 + (int64)nBytes / 1000); + int64 nMinFee = CTransaction::nMinTxFee * (1 + (int64)nBytes / 1000) + CTransaction::nMinTxFee * nQuantityDust; if (CTransaction::AllowFree(dPriority) && nBytes < 10000) nMinFee = 0; @@ -515,7 +518,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) if (nPayFee < CTransaction::nMinTxFee && fLowOutput) { nChange = nChange + nPayFee - CTransaction::nMinTxFee; - nPayFee = CTransaction::nMinTxFee; + nPayFee = CTransaction::nMinTxFee * nQuantityDust; } // if sub-cent change is required, the fee must be raised to at least CTransaction::nMinTxFee