From bbc44f415fe45a1e67fd47c281c0760f231d68e7 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Tue, 20 Jan 2015 01:48:00 -0700 Subject: [PATCH 1/6] lite mode disable checks on block --- src/main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index cb88a84da9..e4e312d986 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3210,9 +3210,11 @@ bool ProcessBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, CDiskBl mapOrphanBlocksByPrev.erase(hashPrev); } - if(!IsInitialBlockDownload()){ - darkSendPool.CheckTimeout(); - darkSendPool.NewBlock(); + if(!fLiteMode){ + if(!IsInitialBlockDownload()){ + darkSendPool.CheckTimeout(); + darkSendPool.NewBlock(); + } } LogPrintf("ProcessBlock: ACCEPTED\n"); From 31215c3a63fbe5c4da2ce17e647047363bb3aea5 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Tue, 20 Jan 2015 02:10:57 -0700 Subject: [PATCH 2/6] print lite mode status in log --- src/init.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/init.cpp b/src/init.cpp index b7448fddd1..d821f822af 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1170,6 +1170,7 @@ bool AppInit2(boost::thread_group& threadGroup) return InitError("You can not start a masternode in litemode"); } + LogPrintf("fLiteMode %d\n", fLiteMode); LogPrintf("nInstantXDepth %d\n", nInstantXDepth); LogPrintf("Darksend rounds %d\n", nDarksendRounds); LogPrintf("Anonymize Darkcoin Amount %d\n", nAnonymizeDarkcoinAmount); From b40bfacb55bb7d9ba48b57323c32d52876aa93c8 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Tue, 20 Jan 2015 02:42:15 -0700 Subject: [PATCH 3/6] improved anonymity for smaller wallets --- configure.ac | 2 +- src/clientversion.h | 2 +- src/wallet.cpp | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 6668296662..ad5344bf89 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 0) define(_CLIENT_VERSION_MINOR, 11) define(_CLIENT_VERSION_REVISION, 0) -define(_CLIENT_VERSION_BUILD, 9) +define(_CLIENT_VERSION_BUILD, 10) define(_CLIENT_VERSION_IS_RELEASE, true) define(_COPYRIGHT_YEAR, 2015) AC_INIT([Darkcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[info@darkcoin.io],[darkcoin]) diff --git a/src/clientversion.h b/src/clientversion.h index 1deba25636..09a780c486 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -12,7 +12,7 @@ #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 11 #define CLIENT_VERSION_REVISION 0 -#define CLIENT_VERSION_BUILD 9 +#define CLIENT_VERSION_BUILD 10 diff --git a/src/wallet.cpp b/src/wallet.cpp index a31ef914ba..32def1e0ed 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1558,6 +1558,9 @@ bool CWallet::SelectCoinsByDenominations(int nDenom, int64_t nValueMin, int64_t if(nValueRet >= nValueMin){ //random reduce the max amount we'll submit for anonymity nValueMax -= (rand() % (nValueMax/5)); + //on average use 50% of the inputs or less + int r = (rand() % (int)vCoins.size()); + if((int)setCoinsRet.size() > r) return true; } //Denomination criterion has been met, we can take any matching denominations if((nDenom & (1 << 0)) && out.tx->vout[out.i].nValue == ((100*COIN)+1)) {fAccepted = true;} From 678a43c35ba80e40b0a116d132bb8aabf0922224 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Tue, 20 Jan 2015 03:02:11 -0700 Subject: [PATCH 4/6] disable reference node code when key is not present --- src/darksend.cpp | 1 - src/masternode.cpp | 3 ++- src/masternode.h | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/darksend.cpp b/src/darksend.cpp index 74ab8471c4..0ecfb726d8 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -1359,7 +1359,6 @@ void CDarkSendPool::NewBlock() { if(fDebug) LogPrintf("CDarkSendPool::NewBlock \n"); - if(IsInitialBlockDownload()) return; masternodePayments.ProcessBlock(chainActive.Tip()->nHeight+10); diff --git a/src/masternode.cpp b/src/masternode.cpp index f73e599b9b..a0ec2ee68c 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -764,7 +764,7 @@ int CMasternodePayments::LastPayment(CMasterNode& mn) bool CMasternodePayments::ProcessBlock(int nBlockHeight) { - if(strMasterPrivKey.empty()) return false; + if(!enabled) return false; CMasternodePaymentWinner winner; uint256 blockHash = 0; @@ -839,6 +839,7 @@ bool CMasternodePayments::SetPrivKey(std::string strPrivKey) if(CheckSignature(winner)){ LogPrintf("CMasternodePayments::SetPrivKey - Successfully initialized as masternode payments master\n"); + enabled = true; return true; } else { return false; diff --git a/src/masternode.h b/src/masternode.h index 61c592c42e..6bb402d503 100644 --- a/src/masternode.h +++ b/src/masternode.h @@ -195,12 +195,14 @@ private: std::string strMasterPrivKey; std::string strTestPubKey; std::string strMainPubKey; + bool enabled; public: CMasternodePayments() { strMainPubKey = "04549ac134f694c0243f503e8c8a9a986f5de6610049c40b07816809b0d1d06a21b07be27b9bb555931773f62ba6cf35a25fd52f694d4e1106ccd237a7bb899fdd"; strTestPubKey = "046f78dcf911fbd61910136f7f0f8d90578f68d0b3ac973b5040fb7afb501b5939f39b108b0569dca71488f5bbf498d92e4d1194f6f941307ffd95f75e76869f0e"; + enabled = false; } bool SetPrivKey(std::string strPrivKey); From 47bb25d853180bc4bf86645ca7492953a2c2b5b3 Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Tue, 20 Jan 2015 03:32:32 -0700 Subject: [PATCH 5/6] disable checktimeout when disabled --- src/darksend.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/darksend.cpp b/src/darksend.cpp index 0ecfb726d8..5e89a41301 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -793,6 +793,8 @@ void CDarkSendPool::ChargeRandomFees(){ // Check for various timeouts (queue objects, darksend, etc) // void CDarkSendPool::CheckTimeout(){ + if(!fEnableDarksend) return; + // catching hanging sessions if(!fMasterNode) { if(state == POOL_STATUS_TRANSMISSION) { From 3322b029eca15763a71813517acdd5800c51046c Mon Sep 17 00:00:00 2001 From: Evan Duffield Date: Tue, 20 Jan 2015 03:39:04 -0700 Subject: [PATCH 6/6] replaced IsInitialBlockDownload with more basic/faster check --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index e4e312d986..dd68fdc5be 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3211,7 +3211,7 @@ bool ProcessBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, CDiskBl } if(!fLiteMode){ - if(!IsInitialBlockDownload()){ + if (!fImporting && !fReindex && chainActive.Height() > Checkpoints::GetTotalBlocksEstimate()){ darkSendPool.CheckTimeout(); darkSendPool.NewBlock(); }