fixed rounds calculation

This commit is contained in:
Evan Duffield 2014-07-24 08:56:49 -07:00
parent 80105fba3e
commit 9c9853b251
2 changed files with 16 additions and 6 deletions

View File

@ -7067,24 +7067,34 @@ int CDarkSendPool::GetInputDarksendRounds(CTxIn in, int rounds)
{
if(rounds >= nDarksendRounds) return rounds;
printf("CDarkSendPool::GetInputDarksendRounds :: %d %s\n", rounds, in.ToString().c_str());
CTransaction tx;
uint256 hash;
if(GetTransaction(in.prevout.hash, tx, hash, true)){
bool fNonDenominatedFound = false;
BOOST_FOREACH(CTxOut out, tx.vout){
if(rounds == 0){ //make sure the final output is non-denominate
bool found = false;
BOOST_FOREACH(int64 d, darkSendDenominations)
if(tx.vout[in.prevout.n].nValue == d) found = true;
if(!found) return -2;
}
bool fNonDenominatedFound = false;
bool found = false;
BOOST_FOREACH(CTxOut out, tx.vout){
BOOST_FOREACH(int64 d, darkSendDenominations)
if(out.nValue == d)
found = true;
if(!found) fNonDenominatedFound = true;
if(fNonDenominatedFound) return rounds;
}
if(!found) return rounds;
// find my vin and look that up
BOOST_FOREACH(CTxIn in2, tx.vin)
BOOST_FOREACH(CTxIn in2, tx.vin) {
printf("CDarkSendPool::GetInputDarksendRounds :: %d %d %s - %s\n", rounds, pwalletMain->IsMine(in2), in2.ToString().c_str());
if(pwalletMain->IsMine(in2))
return GetInputDarksendRounds(in2, rounds+1);
}
}
return -1;
}

View File

@ -1633,7 +1633,7 @@ string CWallet::DarkSendDenominate(int64 nValue)
int64 nValueIn = 0;
//try to use denominated funds (for added anonymity)
if (true) //!SelectCoinsDarkDenominated(nTotalValue, vCoins, nValueIn))
if (!SelectCoinsDarkDenominated(nTotalValue, vCoins, nValueIn))
{
vCoins.clear();
nValueIn = 0;