From 7e39d3fa6b2fd7d2bf3877fa82e091b9455e4cea Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Tue, 14 Oct 2014 11:16:14 -0700 Subject: [PATCH] added some debugging --- src/clientversion.h | 2 +- src/darksend.cpp | 13 +++++++++-- src/test/darksend_tests.cpp | 44 +++++++++++++++++++++++++++++++++++++ src/wallet.cpp | 6 +++-- 4 files changed, 60 insertions(+), 5 deletions(-) diff --git a/src/clientversion.h b/src/clientversion.h index d52be3ec78..c61f4cc3c8 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -9,7 +9,7 @@ #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 10 #define CLIENT_VERSION_REVISION 15 -#define CLIENT_VERSION_BUILD 10 +#define CLIENT_VERSION_BUILD 11 // Set to true for release, false for prerelease or test build #define CLIENT_VERSION_IS_RELEASE true diff --git a/src/darksend.cpp b/src/darksend.cpp index 2ef4ac7218..3841401c9d 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -642,6 +642,8 @@ void CDarkSendPool::SendDarksendDenominate(std::vector& vin, std::vector< LogPrintf("dsi -- transactione not valid! %s \n", tx.ToString().c_str()); return; } + + printf("CDarksendPool::SendDarksendDenominate() - preparing transaction - \n %s\n", tx.ToString().c_str()); } // store our entry for later use @@ -1556,7 +1558,7 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready) sessionAmount = nTotalValue; pnode->PushMessage("dsa", nTotalValue, txCollateral); - LogPrintf("DoAutomaticDenominating --- connected (from queue), sending dsa for %"PRI64d"\n", nTotalValue); + LogPrintf("DoAutomaticDenominating --- connected (from queue), sending dsa for %"PRI64d" - denom %d\n", nTotalValue, GetDenominationsByAmount(nTotalValue)); return true; } } else { @@ -1591,7 +1593,7 @@ bool CDarkSendPool::DoAutomaticDenominating(bool fDryRun, bool ready) sessionAmount = nTotalValue; pnode->PushMessage("dsa", nTotalValue, txCollateral); - LogPrintf("DoAutomaticDenominating --- connected, sending dsa for %"PRI64d"\n", nTotalValue); + LogPrintf("DoAutomaticDenominating --- connected, sending dsa for %"PRI64d" - denom %d\n", nTotalValue, GetDenominationsByAmount(nTotalValue)); return true; } } else { @@ -1855,6 +1857,13 @@ bool CDarkSendPool::IsCompatibleWithEntries(std::vector vout) { BOOST_FOREACH(const CDarkSendEntry v, entries) { LogPrintf(" IsCompatibleWithEntries %d %d\n", GetDenominations(vout), GetDenominations(v.vout)); + + BOOST_FOREACH(CTxOut o1, vout) + LogPrintf(" vout 1 - %s\n", o1.ToString().c_str()); + + BOOST_FOREACH(CTxOut o2, v.vout) + LogPrintf(" vout 2 - %s\n", o2.ToString().c_str()); + if(GetDenominations(vout) != GetDenominations(v.vout)) return false; } diff --git a/src/test/darksend_tests.cpp b/src/test/darksend_tests.cpp index 59771a84ff..f544935b9f 100644 --- a/src/test/darksend_tests.cpp +++ b/src/test/darksend_tests.cpp @@ -170,6 +170,50 @@ BOOST_AUTO_TEST_CASE(darksend_denom) BOOST_CHECK(darkSendPool.GetDenominations(vout1) != darkSendPool.GetDenominations(vout2)); + vout1.clear(); + vout2.clear(); + + vout1.push_back(d1); + vout1.push_back(d3); + vout1.push_back(d2); + + vout2.push_back(d1); + vout2.push_back(d2); + vout2.push_back(d3); + + BOOST_CHECK(darkSendPool.GetDenominations(vout1) == darkSendPool.GetDenominations(vout2)); + + vout1.clear(); + vout2.clear(); + + vout1.push_back(d1); + vout1.push_back(d3); + vout1.push_back(d2); + + vout2.push_back(d3); + vout2.push_back(d2); + vout2.push_back(d1); + + BOOST_CHECK(darkSendPool.GetDenominations(vout1) == darkSendPool.GetDenominations(vout2)); + + vout1.clear(); + vout2.clear(); + + vout1.push_back(d1); + vout1.push_back(d3); + vout1.push_back(d2); + + vout2.push_back(d3); + vout2.push_back(d2); + vout2.push_back(d2); + vout2.push_back(d2); + vout2.push_back(d1); + + BOOST_CHECK(darkSendPool.GetDenominations(vout1) == darkSendPool.GetDenominations(vout2)); + + vout2.push_back(d4); + + BOOST_CHECK(darkSendPool.GetDenominations(vout1) != darkSendPool.GetDenominations(vout2)); } BOOST_AUTO_TEST_CASE(darksend_session) diff --git a/src/wallet.cpp b/src/wallet.cpp index 538e1cb8e5..44aaa99b68 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1833,7 +1833,7 @@ string CWallet::PrepareDarksendDenominate(int minRounds, int64 maxAmount) } } - int64 nFeeRet = 0.0125*COIN; ///need to get a better fee calc + int64 nFeeRet = 0.0125*COIN; // ** find the coins we'll use std::vector vCoins; @@ -1844,7 +1844,7 @@ string CWallet::PrepareDarksendDenominate(int minRounds, int64 maxAmount) bool hasFeeInput = false; //select coins we'll use - if (!SelectCoinsDark(1*COIN, maxAmount, vCoins, nValueIn, minRounds, nDarksendRounds, hasFeeInput)) + if (!SelectCoinsDark(1*COIN, maxAmount + nFeeRet, vCoins, nValueIn, minRounds, nDarksendRounds, hasFeeInput)) { vCoins.clear(); @@ -1858,6 +1858,8 @@ string CWallet::PrepareDarksendDenominate(int minRounds, int64 maxAmount) // calculate total value out int64 nTotalValue = GetTotalValue(vCoins) - nFeeRet; + LogPrintf("PrepareDarksendDenominate - preparing darksend denominate . Asked for: %"PRI64u", Got: %"PRI64u" \n", maxAmount, nTotalValue); + //-------------- BOOST_FOREACH(CTxIn v, vCoins)