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)
This commit is contained in:
UdjinM6 2015-06-23 18:47:05 +03:00
parent 511b11aa53
commit 5037c710de

View File

@ -1662,6 +1662,27 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
vector<COutput> vCoins; vector<COutput> vCoins;
AvailableCoins(vCoins, true, coinControl, coin_type, useIX); 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 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 // Make outputs by looping through denominations, from large to small
@ -1684,19 +1705,6 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
return (nValueRet >= nTargetValue); return (nValueRet >= 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) || return (SelectCoinsMinConf(nTargetValue, 1, 6, vCoins, setCoinsRet, nValueRet) ||
SelectCoinsMinConf(nTargetValue, 1, 1, vCoins, setCoinsRet, nValueRet) || SelectCoinsMinConf(nTargetValue, 1, 1, vCoins, setCoinsRet, nValueRet) ||
(bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue, 0, 1, vCoins, setCoinsRet, nValueRet))); (bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue, 0, 1, vCoins, setCoinsRet, nValueRet)));