Merge pull request #470 from UdjinM6/v0.12.0.x_fix_rpc_darksend_lock

V0.12.0.x fix rpc for darksend
This commit is contained in:
evan82 2015-08-03 13:16:56 -07:00
commit cc4b40616f
2 changed files with 10 additions and 5 deletions

View File

@ -445,7 +445,7 @@ std::string CDarksendPool::GetStatus()
showingDarkSendMessage += 10; showingDarkSendMessage += 10;
std::string suffix = ""; std::string suffix = "";
if(chainActive.Tip()->nHeight - cachedLastSuccess < minBlockSpacing) { if(chainActive.Tip()->nHeight - cachedLastSuccess < minBlockSpacing || !masternodeSync.IsBlockchainSynced()) {
return strAutoDenomResult; return strAutoDenomResult;
} }
switch(state) { switch(state) {
@ -1352,6 +1352,12 @@ void CDarksendPool::ClearLastMessage()
// //
bool CDarksendPool::DoAutomaticDenominating(bool fDryRun, bool ready) 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); LOCK(cs_darksend);
if(!masternodeSync.IsBlockchainSynced()) { if(!masternodeSync.IsBlockchainSynced()) {

View File

@ -57,7 +57,7 @@ Value darksend(const Array& params, bool fHelp)
throw runtime_error( throw runtime_error(
"darksend <dashaddress> <amount>\n" "darksend <dashaddress> <amount>\n"
"dashaddress, reset, or auto (AutoDenominate)" "dashaddress, reset, or auto (AutoDenominate)"
"<amount> is a real and is rounded to the nearest 0.00000001" "<amount> is a real and will be rounded to the next 0.1"
+ HelpRequiringPassphrase()); + HelpRequiringPassphrase());
if (pwalletMain->IsLocked()) if (pwalletMain->IsLocked())
@ -67,8 +67,7 @@ Value darksend(const Array& params, bool fHelp)
if(fMasterNode) if(fMasterNode)
return "DarkSend is not supported from masternodes"; return "DarkSend is not supported from masternodes";
darkSendPool.DoAutomaticDenominating(); return "DoAutomaticDenominating " + (darkSendPool.DoAutomaticDenominating() ? "successful" : ("failed: " + darkSendPool.GetStatus()));
return "DoAutomaticDenominating";
} }
if(params[0].get_str() == "reset"){ if(params[0].get_str() == "reset"){
@ -80,7 +79,7 @@ Value darksend(const Array& params, bool fHelp)
throw runtime_error( throw runtime_error(
"darksend <dashaddress> <amount>\n" "darksend <dashaddress> <amount>\n"
"dashaddress, denominate, or auto (AutoDenominate)" "dashaddress, denominate, or auto (AutoDenominate)"
"<amount> is a real and is rounded to the nearest 0.00000001" "<amount> is a real and will be rounded to the next 0.1"
+ HelpRequiringPassphrase()); + HelpRequiringPassphrase());
CBitcoinAddress address(params[0].get_str()); CBitcoinAddress address(params[0].get_str());