From 9c9853b2512371a1818d09e43b2e62e1b89a8f47 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Thu, 24 Jul 2014 08:56:49 -0700 Subject: [PATCH] fixed rounds calculation --- src/main.cpp | 20 +++++++++++++++----- src/wallet.cpp | 2 +- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ed8749fc10..158ff01b29 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7067,23 +7067,33 @@ 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; diff --git a/src/wallet.cpp b/src/wallet.cpp index 8a80a2d9e2..d2ee1d5bb9 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -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;