diff --git a/src/wallet.cpp b/src/wallet.cpp index 6593188b3afb..a94016c7bc6a 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -4209,8 +4209,8 @@ void CWallet::AutoCombineDust() vRewardCoins.push_back(out); nTotalRewardsValue += out.Value(); - // Combine to the threshold and not way above - if (nTotalRewardsValue > nAutoCombineThreshold * COIN) + // Combine until our total is enough above the threshold to remain above after adjustments + if ((nTotalRewardsValue - nTotalRewardsValue / 10) > nAutoCombineThreshold * COIN) break; // Around 180 bytes per input. We use 190 to be certain @@ -4256,7 +4256,7 @@ void CWallet::AutoCombineDust() } //we don't combine below the threshold unless the fees are 0 to avoid paying fees over fees over fees - if (!maxSize && nTotalRewardsValue < nAutoCombineThreshold * COIN && nFeeRet > 0) + if (!maxSize && vecSend[0].second < nAutoCombineThreshold * COIN && nFeeRet > 0) continue; if (!CommitTransaction(wtx, keyChange)) { @@ -4264,7 +4264,8 @@ void CWallet::AutoCombineDust() continue; } - LogPrintf("AutoCombineDust sent transaction\n"); + LogPrintf("AutoCombineDust sent transaction. Fee=%d, Total Value=%d Sending=%d\n", + nFeeRet, nTotalRewardsValue, vecSend[0].second); delete coinControl; }