Add new "getmininginfo" JSON-RPC method, with mining-only fields moved out of "getinfo"
This commit is contained in:
parent
025d495481
commit
6950bb6200
@ -347,10 +347,7 @@ Value getinfo(const Array& params, bool fHelp)
|
||||
obj.push_back(Pair("blocks", (int)nBestHeight));
|
||||
obj.push_back(Pair("connections", (int)vNodes.size()));
|
||||
obj.push_back(Pair("proxy", (fUseProxy ? addrProxy.ToStringIPPort() : string())));
|
||||
obj.push_back(Pair("generate", (bool)fGenerateBitcoins));
|
||||
obj.push_back(Pair("genproclimit", (int)(fLimitProcessors ? nLimitProcessors : -1)));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
obj.push_back(Pair("hashespersec", gethashespersec(params, false)));
|
||||
obj.push_back(Pair("testnet", fTestNet));
|
||||
obj.push_back(Pair("keypoololdest", (boost::int64_t)pwalletMain->GetOldestKeyPoolTime()));
|
||||
obj.push_back(Pair("keypoolsize", pwalletMain->GetKeyPoolSize()));
|
||||
@ -362,6 +359,25 @@ Value getinfo(const Array& params, bool fHelp)
|
||||
}
|
||||
|
||||
|
||||
Value getmininginfo(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 0)
|
||||
throw runtime_error(
|
||||
"getmininginfo\n"
|
||||
"Returns an object containing mining-related information.");
|
||||
|
||||
Object obj;
|
||||
obj.push_back(Pair("blocks", (int)nBestHeight));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||
obj.push_back(Pair("generate", (bool)fGenerateBitcoins));
|
||||
obj.push_back(Pair("genproclimit", (int)(fLimitProcessors ? nLimitProcessors : -1)));
|
||||
obj.push_back(Pair("hashespersec", gethashespersec(params, false)));
|
||||
obj.push_back(Pair("testnet", fTestNet));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
Value getnewaddress(const Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() > 1)
|
||||
@ -1986,6 +2002,7 @@ pair<string, rpcfn_type> pCallTable[] =
|
||||
make_pair("setgenerate", &setgenerate),
|
||||
make_pair("gethashespersec", &gethashespersec),
|
||||
make_pair("getinfo", &getinfo),
|
||||
make_pair("getmininginfo", &getmininginfo),
|
||||
make_pair("getnewaddress", &getnewaddress),
|
||||
make_pair("getaccountaddress", &getaccountaddress),
|
||||
make_pair("setaccount", &setaccount),
|
||||
@ -2036,6 +2053,7 @@ string pAllowInSafeMode[] =
|
||||
"setgenerate",
|
||||
"gethashespersec",
|
||||
"getinfo",
|
||||
"getmininginfo",
|
||||
"getnewaddress",
|
||||
"getaccountaddress",
|
||||
"getaccount",
|
||||
|
Loading…
Reference in New Issue
Block a user