From 240bb10d3393c87e50d68852168e1195de57034a Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 3 Aug 2015 22:53:00 +0300 Subject: [PATCH] fix rpc for darksend --- src/darksend.cpp | 8 +++++++- src/rpcmasternode.cpp | 7 +++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/darksend.cpp b/src/darksend.cpp index d0adda003..c4f9aee4f 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -445,7 +445,7 @@ std::string CDarksendPool::GetStatus() showingDarkSendMessage += 10; std::string suffix = ""; - if(chainActive.Tip()->nHeight - cachedLastSuccess < minBlockSpacing) { + if(chainActive.Tip()->nHeight - cachedLastSuccess < minBlockSpacing || !masternodeSync.IsBlockchainSynced()) { return strAutoDenomResult; } switch(state) { @@ -1352,6 +1352,12 @@ void CDarksendPool::ClearLastMessage() // bool CDarksendPool::DoAutomaticDenominating(bool fDryRun, bool ready) { + TRY_LOCK(cs_darksend, lockDS); + if(!lockDS) { + strAutoDenomResult = _("Lock is already in place."); + return false; + } + LOCK(cs_darksend); if(!masternodeSync.IsBlockchainSynced()) { diff --git a/src/rpcmasternode.cpp b/src/rpcmasternode.cpp index cd6ad39d5..53283b555 100644 --- a/src/rpcmasternode.cpp +++ b/src/rpcmasternode.cpp @@ -57,7 +57,7 @@ Value darksend(const Array& params, bool fHelp) throw runtime_error( "darksend \n" "dashaddress, reset, or auto (AutoDenominate)" - " is a real and is rounded to the nearest 0.00000001" + " is a real and will be rounded to the next 0.1" + HelpRequiringPassphrase()); if (pwalletMain->IsLocked()) @@ -67,8 +67,7 @@ Value darksend(const Array& params, bool fHelp) if(fMasterNode) return "DarkSend is not supported from masternodes"; - darkSendPool.DoAutomaticDenominating(); - return "DoAutomaticDenominating"; + return "DoAutomaticDenominating " + (darkSendPool.DoAutomaticDenominating() ? "successful" : ("failed: " + darkSendPool.GetStatus())); } if(params[0].get_str() == "reset"){ @@ -80,7 +79,7 @@ Value darksend(const Array& params, bool fHelp) throw runtime_error( "darksend \n" "dashaddress, denominate, or auto (AutoDenominate)" - " is a real and is rounded to the nearest 0.00000001" + " is a real and will be rounded to the next 0.1" + HelpRequiringPassphrase()); CBitcoinAddress address(params[0].get_str());