From ec5500bd8c8a1ccd46c24c3eaa114de8f5cfdfcb Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Sat, 12 Apr 2014 21:59:22 +0100 Subject: [PATCH] Made it clearer how coins are chosen for use when making a transaction, by switching from COIN as constant to DUST_SOFT_LIMIT. --- src/main.h | 2 +- src/wallet.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.h b/src/main.h index 666a1293c..155ad413d 100644 --- a/src/main.h +++ b/src/main.h @@ -59,7 +59,7 @@ static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB /** The pre-allocation chunk size for rev?????.dat files (since 0.8) */ static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000; // 1 MiB /** Dust Soft Limit, allowed with additional fee per output */ -static const int64_t DUST_SOFT_LIMIT = 100000000; +static const int64_t DUST_SOFT_LIMIT = COIN; /** Dust Hard Limit, ignored as wallet inputs (mininput default) */ static const int64_t DUST_HARD_LIMIT = 1000000; /** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */ diff --git a/src/wallet.cpp b/src/wallet.cpp index c6bb835e5..a4327f7b3 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1226,8 +1226,9 @@ bool CWallet::SelectCoinsMinConf(int64_t nTargetValue, int nConfMine, int nConfT nValueRet += coin.first; return true; } - else if (n < nTargetValue + COIN) + else if (n < nTargetValue + DUST_SOFT_LIMIT) { + // Skip coins which, if used, would result in less than a transaction fee in change vValue.push_back(coin); nTotalLower += n; }