Skip to content

Commit eb603b4

Browse files
committed
[Wallet] Fix autocombine
-small nit, use while instead of empty for -use nTotalRewardsValue instead of vecSend[0].second to check value is above threshold
1 parent 3f9e746 commit eb603b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/wallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2720,7 +2720,7 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, CAmount> >& vecSend,
27202720
scriptChange = GetScriptForDestination(coinControl->destChange);
27212721

27222722
vector<CTxOut>::iterator it = txNew.vout.begin();
2723-
for (; it != txNew.vout.end();) {
2723+
while (it != txNew.vout.end()) {
27242724
if (scriptChange == it->scriptPubKey) {
27252725
it->nValue += nChange;
27262726
nChange = 0;
@@ -4075,7 +4075,7 @@ void CWallet::AutoCombineDust()
40754075
}
40764076

40774077
//we don't combine below the threshold unless the fees are 0 to avoid paying fees over fees over fees
4078-
if (vecSend[0].second < nAutoCombineThreshold * COIN && nFeeRet > 0)
4078+
if (nTotalRewardsValue < nAutoCombineThreshold * COIN && nFeeRet > 0)
40794079
continue;
40804080

40814081
if (!CommitTransaction(wtx, keyChange)) {

0 commit comments

Comments
 (0)