Merge pull request #378 from UdjinM6/v0.12.0.x_ds_coincontrol

V0.12.0.x ds coincontrol
This commit is contained in:
evan82 2015-06-23 10:12:26 -07:00
commit f12664166b

View File

@ -1664,8 +1664,29 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
vector<COutput> 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)
{
@ -1686,19 +1707,6 @@ bool CWallet::SelectCoins(const CAmount& nTargetValue, set<pair<const CWalletTx*
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) ||
SelectCoinsMinConf(nTargetValue, 1, 1, vCoins, setCoinsRet, nValueRet) ||
(bSpendZeroConfChange && SelectCoinsMinConf(nTargetValue, 0, 1, vCoins, setCoinsRet, nValueRet)));