From 093f1abf40ebd983f61321cc50ff850431262a1f Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Sun, 3 Nov 2019 09:53:27 +0000 Subject: [PATCH] Correct dust and change Correct dust threshold, which is never less than 1 DOGE. Correct minimum change, which is 1 DOGE. --- src/dogecoin.cpp | 3 +-- src/primitives/transaction.h | 3 ++- src/wallet/wallet.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dogecoin.cpp b/src/dogecoin.cpp index 3f06e8a49..5336d625b 100644 --- a/src/dogecoin.cpp +++ b/src/dogecoin.cpp @@ -181,8 +181,7 @@ CAmount GetDogecoinDustFee(const std::vector &vout, CFeeRate &baseFeeRat // To limit dust spam, add base fee for each output less than a COIN BOOST_FOREACH(const CTxOut& txout, vout) - // if (txout.IsDust(::minRelayTxFee)) - if (txout.nValue < COIN) + if (txout.IsDust(::minRelayTxFee)) nFee += baseFeeRate.GetFeePerK(); return nFee; diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index ceb8f6ace..6e275a93d 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -190,7 +190,8 @@ public: nSize += (32 + 4 + 1 + 107 + 4); // the 148 mentioned above } - return 3 * minRelayTxFee.GetFee(nSize); + // Dogecoin: Anything below 1 DOGE is always dust + return std::max(COIN, 3 * minRelayTxFee.GetFee(nSize)); } bool IsDust(const CFeeRate &minRelayTxFee) const diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 5f77a31ea..09a18f520 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -53,9 +53,9 @@ static const CAmount DEFAULT_TRANSACTION_MINFEE = COIN; //! minimum recommended increment for BIP 125 replacement txs static const CAmount WALLET_INCREMENTAL_RELAY_FEE = COIN * 5; //! target minimum change amount -static const CAmount MIN_CHANGE = CENT; +static const CAmount MIN_CHANGE = COIN; //! final minimum change amount after paying for fees -static const CAmount MIN_FINAL_CHANGE = MIN_CHANGE/2; +static const CAmount MIN_FINAL_CHANGE = COIN; //! Default for -spendzeroconfchange static const bool DEFAULT_SPEND_ZEROCONF_CHANGE = true; //! Default for -sendfreetransactions