From 5037c710de843fe34c3423fb41142c66d73de9df Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Tue, 23 Jun 2015 18:47:05 +0300 Subject: [PATCH] When DS inputs are selected in coincontrol: - spend exactly these inputs - allow to spend more than 0.1 as a fee (note: still will respect non-ds fee limits) --- src/wallet.cpp | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/wallet.cpp b/src/wallet.cpp index a05599c106..276ca7a94e 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1662,8 +1662,29 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set vCoins; AvailableCoins(vCoins, true, coinControl, coin_type, useIX); + // coin control -> return all selected outputs (we want all selected to go into the transaction for sure) + if (coinControl && coinControl->HasSelected()) + { + BOOST_FOREACH(const COutput& out, vCoins) + { + if(!out.fSpendable) + continue; + + if(coin_type == ONLY_DENOMINATED) { + CTxIn vin = CTxIn(out.tx->GetHash(),out.i); + int rounds = GetInputDarksendRounds(vin); + // make sure it's actually anonymized + if(rounds < nDarksendRounds) continue; + } + + nValueRet += out.tx->vout[out.i].nValue; + setCoinsRet.insert(make_pair(out.tx, out.i)); + } + return (nValueRet >= nTargetValue); + } + //if we're doing only denominated, we need to round up to the nearest .1DRK - if(coin_type == ONLY_DENOMINATED){ + if(coin_type == ONLY_DENOMINATED) { // Make outputs by looping through denominations, from large to small BOOST_FOREACH(int64_t v, darkSendDenominations) { @@ -1684,19 +1705,6 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set= nTargetValue); } - // coin control -> return all selected outputs (we want all selected to go into the transaction for sure) - if (coinControl && coinControl->HasSelected()) - { - BOOST_FOREACH(const COutput& out, vCoins) - { - if(!out.fSpendable) - continue; - nValueRet += out.tx->vout[out.i].nValue; - setCoinsRet.insert(make_pair(out.tx, out.i)); - } - return (nValueRet >= nTargetValue); - } - return (SelectCoinsMinConf(nTargetValue, 1, 6, vCoins, setCoinsRet, nValueRet) || SelectCoinsMinConf(nTargetValue, 1, 1, vCoins, setCoinsRet, nValueRet) || (bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue, 0, 1, vCoins, setCoinsRet, nValueRet)));