From c26327b8094cf94ba5948cd41f8220f4a8f2a313 Mon Sep 17 00:00:00 2001 From: Jannis Froese Date: Sat, 29 Mar 2014 20:03:19 +0100 Subject: [PATCH] adjust code to reflect higher dust limit of Dogecoin --- src/qt/coincontroldialog.cpp | 12 ++++++------ src/wallet.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 3aeb9eee9..d4e7102b4 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -436,7 +436,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) if (amount > 0) { - if (amount < CENT) + if (amount < COIN) fLowOutput = true; CTxOut txout(amount, (CScript)vector(24, 0)); @@ -525,7 +525,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) nChange = nAmount - nPayFee - nPayAmount; // if sub-cent change is required, the fee must be raised to at least CTransaction::nMinTxFee - if (nPayFee < CTransaction::nMinTxFee && nChange > 0 && nChange < CENT) + if (nPayFee < CTransaction::nMinTxFee && nChange > 0 && nChange < COIN) { if (nChange < CTransaction::nMinTxFee) // change < 0.0001 => simply move all change to fees { @@ -540,7 +540,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) } // Never create dust outputs; if we would, just add the dust to the fee. - if (nChange > 0 && nChange < CENT) + if (nChange > 0 && nChange < COIN) { CTxOut txout(nChange, (CScript)vector(24, 0)); if (txout.IsDust(CTransaction::nMinRelayTxFee)) @@ -594,7 +594,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) l5->setStyleSheet((nBytes >= 1000) ? "color:red;" : ""); // Bytes >= 1000 l6->setStyleSheet((dPriority > 0 && !AllowFree(dPriority)) ? "color:red;" : ""); // Priority < "medium" l7->setStyleSheet((fLowOutput) ? "color:red;" : ""); // Low Output = "yes" - l8->setStyleSheet((nChange > 0 && nChange < CENT) ? "color:red;" : ""); // Change < 0.01DOGE + l8->setStyleSheet((nChange > 0 && nChange < COIN) ? "color:red;" : ""); // Change < 0.01DOGE // tool tips QString toolTip1 = tr("This label turns red, if the transaction size is greater than 1000 bytes.") + "

"; @@ -605,11 +605,11 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) toolTip2 += tr("This label turns red, if the priority is smaller than \"medium\".") + "

"; toolTip2 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)); - QString toolTip3 = tr("This label turns red, if any recipient receives an amount smaller than %1.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)) + "

"; + QString toolTip3 = tr("This label turns red, if any recipient receives an amount smaller than %1.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, COIN)) + "

"; toolTip3 += tr("This means a fee of at least %1 is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)) + "

"; toolTip3 += tr("Amounts below 0.546 times the minimum relay fee are shown as dust."); - QString toolTip4 = tr("This label turns red, if the change is smaller than %1.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CENT)) + "

"; + QString toolTip4 = tr("This label turns red, if the change is smaller than %1.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, COIN)) + "

"; toolTip4 += tr("This means a fee of at least %1 is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CTransaction::nMinTxFee)); l5->setToolTip(toolTip1); diff --git a/src/wallet.cpp b/src/wallet.cpp index 46a6d629d..5dd2cdafd 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1114,7 +1114,7 @@ bool CWallet::SelectCoinsMinConf(int64_t nTargetValue, int nConfMine, int nConfT nValueRet += coin.first; return true; } - else if (n < nTargetValue + CENT) + else if (n < nTargetValue + COIN) { vValue.push_back(coin); nTotalLower += n; @@ -1150,13 +1150,13 @@ bool CWallet::SelectCoinsMinConf(int64_t nTargetValue, int nConfMine, int nConfT int64_t nBest; ApproximateBestSubset(vValue, nTotalLower, nTargetValue, vfBest, nBest, 1000); - if (nBest != nTargetValue && nTotalLower >= nTargetValue + CENT) - ApproximateBestSubset(vValue, nTotalLower, nTargetValue + CENT, vfBest, nBest, 1000); + if (nBest != nTargetValue && nTotalLower >= nTargetValue + COIN) + ApproximateBestSubset(vValue, nTotalLower, nTargetValue + COIN, vfBest, nBest, 1000); // If we have a bigger coin and (either the stochastic approximation didn't find a good solution, // or the next bigger coin is closer), return the bigger coin if (coinLowestLarger.second.first && - ((nBest != nTargetValue && nBest < nTargetValue + CENT) || coinLowestLarger.first <= nBest)) + ((nBest != nTargetValue && nBest < nTargetValue + COIN) || coinLowestLarger.first <= nBest)) { setCoinsRet.insert(coinLowestLarger.second); nValueRet += coinLowestLarger.first; @@ -1269,8 +1269,8 @@ bool CWallet::CreateTransaction(const vector >& vecSend, // The following if statement should be removed once enough miners // have upgraded to the 0.9 GetMinFee() rules. Until then, this avoids // creating free transactions that have change outputs less than - // CENT dogecoins. - if (nFeeRet < CTransaction::nMinTxFee && nChange > 0 && nChange < CENT) + // COIN dogecoins. + if (nFeeRet < CTransaction::nMinTxFee && nChange > 0 && nChange < COIN) { int64_t nMoveToFee = min(nChange, CTransaction::nMinTxFee - nFeeRet); nChange -= nMoveToFee;