diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 9ec616b3a..3ef425575 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2735,7 +2735,16 @@ bool CWallet::CreateTransaction(const vector& vecSend, CWalletTx& wt CAmount additionalFeeNeeded = nFeeNeeded - nFeeRet; vector::iterator change_position = txNew.vout.begin()+nChangePosInOut; // Only reduce change if remaining amount is still a large enough output. - if (change_position->nValue >= MIN_FINAL_CHANGE + additionalFeeNeeded) { + /* Dogecoin: this has been changed from a static MIN_FINAL_CHANGE that + * followed DEFAULT_DISCARD_THRESHOLD to instead use the configurable + * discard threshold. + * + * Note: + * If MIN_CHANGE ever becomes configurable or otherwise changes to no + * longer be derived from DEFAULT_DISCARD_THRESHOLD, then this check + * must be adapted. + */ + if (change_position->nValue >= discardThreshold + additionalFeeNeeded) { change_position->nValue -= additionalFeeNeeded; nFeeRet += additionalFeeNeeded; break; // Done, able to increase fee from change diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index cef25b502..7652b7c37 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -105,8 +105,6 @@ static const CAmount WALLET_INCREMENTAL_RELAY_FEE = RECOMMENDED_MIN_TX_FEE / 10; */ //! target minimum change amount static const CAmount MIN_CHANGE = DEFAULT_DISCARD_THRESHOLD + 2 * RECOMMENDED_MIN_TX_FEE; -//! final minimum change amount after paying for fees -static const CAmount MIN_FINAL_CHANGE = DEFAULT_DISCARD_THRESHOLD; //! Default for -spendzeroconfchange static const bool DEFAULT_SPEND_ZEROCONF_CHANGE = true;