mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Merge pull request #378 from UdjinM6/v0.12.0.x_ds_coincontrol
V0.12.0.x ds coincontrol
This commit is contained in:
commit
f12664166b
@ -1664,6 +1664,27 @@ 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) {
|
||||
// Make outputs by looping through denominations, from large to small
|
||||
@ -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)));
|
||||
|
Loading…
Reference in New Issue
Block a user