mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-22 20:44:56 +00:00
rework locking in getinfo to fix deadlock
This commit is contained in:
parent
78f3ceb921
commit
37aa4f1827
@ -210,7 +210,7 @@ static const CRPCCommand vRPCCommands[] =
|
||||
{ "getgenerate", &getgenerate, true, false },
|
||||
{ "setgenerate", &setgenerate, true, false },
|
||||
{ "gethashespersec", &gethashespersec, true, false },
|
||||
{ "getinfo", &getinfo, true, false },
|
||||
{ "getinfo", &getinfo, true, true },
|
||||
{ "getmininginfo", &getmininginfo, true, false },
|
||||
{ "createwalletuser", &createwalletuser, true, false },
|
||||
{ "listwalletusers", &listwalletusers, true, false },
|
||||
@ -249,8 +249,8 @@ static const CRPCCommand vRPCCommands[] =
|
||||
{ "newrtmsg", &newrtmsg, false, true },
|
||||
{ "getposts", &getposts, false, true },
|
||||
{ "getdirectmsgs", &getdirectmsgs, false, true },
|
||||
{ "setspammsg", &setspammsg, false, true },
|
||||
{ "getspammsg", &getspammsg, false, true },
|
||||
{ "setspammsg", &setspammsg, false, false },
|
||||
{ "getspammsg", &getspammsg, false, false },
|
||||
{ "follow", &follow, false, true },
|
||||
{ "unfollow", &unfollow, false, true },
|
||||
{ "getfollowing", &getfollowing, false, true },
|
||||
|
@ -77,16 +77,25 @@ Value getinfo(const Array& params, bool fHelp)
|
||||
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
||||
obj.push_back(Pair("blocks", (int)nBestHeight));
|
||||
obj.push_back(Pair("timeoffset", (boost::int64_t)GetTimeOffset()));
|
||||
obj.push_back(Pair("connections", (int)vNodes.size()));
|
||||
{
|
||||
LOCK(cs_main);
|
||||
obj.push_back(Pair("connections", (int)vNodes.size()));
|
||||
obj.push_back(Pair("addrman_total", (int)addrman.size()));
|
||||
obj.push_back(Pair("addrman_get", (int)addrman.GetAddr().size()));
|
||||
}
|
||||
obj.push_back(Pair("dht_nodes", getDhtNodes()));
|
||||
obj.push_back(Pair("addrman_total", (int)addrman.size()));
|
||||
obj.push_back(Pair("addrman_get", (int)addrman.GetAddr().size()));
|
||||
obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string())));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
obj.push_back(Pair("testnet", TestNet()));
|
||||
if (pwalletMain->IsCrypted())
|
||||
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime));
|
||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||
{
|
||||
LOCK(cs_main);
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
obj.push_back(Pair("testnet", TestNet()));
|
||||
{
|
||||
LOCK(pwalletMain->cs_wallet);
|
||||
if (pwalletMain->IsCrypted())
|
||||
obj.push_back(Pair("unlocked_until", (boost::int64_t)nWalletUnlockTime));
|
||||
}
|
||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -1542,7 +1542,6 @@ Value setspammsg(const Array& params, bool fHelp)
|
||||
string strUsername = params[0].get_str();
|
||||
string strMsg = params[1].get_str();
|
||||
|
||||
LOCK(cs_main);
|
||||
strSpamUser = strUsername;
|
||||
strSpamMessage = strMsg;
|
||||
|
||||
@ -1557,7 +1556,6 @@ Value getspammsg(const Array& params, bool fHelp)
|
||||
"get spam message attached to generated blocks");
|
||||
|
||||
Array ret;
|
||||
LOCK(cs_main);
|
||||
ret.push_back(strSpamUser);
|
||||
ret.push_back(strSpamMessage);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user