|
|
@ -74,19 +74,60 @@ int64_t GetNetworkHashPS(int lookup, int height) { |
|
|
|
return (int64_t)(workDiff.getdouble() / timeDiff); |
|
|
|
} |
|
|
|
|
|
|
|
Value getlocalsolps(const Array& params, bool fHelp) |
|
|
|
{ |
|
|
|
if (fHelp) |
|
|
|
throw runtime_error( |
|
|
|
"getlocalsolps\n" |
|
|
|
"\nReturns the average local solutions per second since this node was started.\n" |
|
|
|
"This is the same information shown on the metrics screen (if enabled).\n" |
|
|
|
"\nResult:\n" |
|
|
|
"xxx.xxxxx (numeric) Solutions per second average\n" |
|
|
|
"\nExamples:\n" |
|
|
|
+ HelpExampleCli("getlocalsolps", "") |
|
|
|
+ HelpExampleRpc("getlocalsolps", "") |
|
|
|
); |
|
|
|
|
|
|
|
LOCK(cs_main); |
|
|
|
return GetLocalSolPS(); |
|
|
|
} |
|
|
|
|
|
|
|
Value getnetworksolps(const Array& params, bool fHelp) |
|
|
|
{ |
|
|
|
if (fHelp || params.size() > 2) |
|
|
|
throw runtime_error( |
|
|
|
"getnetworksolps ( blocks height )\n" |
|
|
|
"\nReturns the estimated network solutions per second based on the last n blocks.\n" |
|
|
|
"Pass in [blocks] to override # of blocks, -1 specifies over difficulty averaging window.\n" |
|
|
|
"Pass in [height] to estimate the network speed at the time when a certain block was found.\n" |
|
|
|
"\nArguments:\n" |
|
|
|
"1. blocks (numeric, optional, default=120) The number of blocks, or -1 for blocks over difficulty averaging window.\n" |
|
|
|
"2. height (numeric, optional, default=-1) To estimate at the time of the given height.\n" |
|
|
|
"\nResult:\n" |
|
|
|
"x (numeric) Solutions per second estimated\n" |
|
|
|
"\nExamples:\n" |
|
|
|
+ HelpExampleCli("getnetworksolps", "") |
|
|
|
+ HelpExampleRpc("getnetworksolps", "") |
|
|
|
); |
|
|
|
|
|
|
|
LOCK(cs_main); |
|
|
|
return GetNetworkHashPS(params.size() > 0 ? params[0].get_int() : 120, params.size() > 1 ? params[1].get_int() : -1); |
|
|
|
} |
|
|
|
|
|
|
|
Value getnetworkhashps(const Array& params, bool fHelp) |
|
|
|
{ |
|
|
|
if (fHelp || params.size() > 2) |
|
|
|
throw runtime_error( |
|
|
|
"getnetworkhashps ( blocks height )\n" |
|
|
|
"\nReturns the estimated network hashes per second based on the last n blocks.\n" |
|
|
|
"\nDEPRECATED - left for backwards-compatibility. Use getnetworksolps instead.\n" |
|
|
|
"\nReturns the estimated network solutions per second based on the last n blocks.\n" |
|
|
|
"Pass in [blocks] to override # of blocks, -1 specifies over difficulty averaging window.\n" |
|
|
|
"Pass in [height] to estimate the network speed at the time when a certain block was found.\n" |
|
|
|
"\nArguments:\n" |
|
|
|
"1. blocks (numeric, optional, default=120) The number of blocks, or -1 for blocks over difficulty averaging window.\n" |
|
|
|
"2. height (numeric, optional, default=-1) To estimate at the time of the given height.\n" |
|
|
|
"\nResult:\n" |
|
|
|
"x (numeric) Hashes per second estimated\n" |
|
|
|
"x (numeric) Solutions per second estimated\n" |
|
|
|
"\nExamples:\n" |
|
|
|
+ HelpExampleCli("getnetworkhashps", "") |
|
|
|
+ HelpExampleRpc("getnetworkhashps", "") |
|
|
@ -275,6 +316,8 @@ Value getmininginfo(const Array& params, bool fHelp) |
|
|
|
" \"errors\": \"...\" (string) Current errors\n" |
|
|
|
" \"generate\": true|false (boolean) If the generation is on or off (see getgenerate or setgenerate calls)\n" |
|
|
|
" \"genproclimit\": n (numeric) The processor limit for generation. -1 if no generation. (see getgenerate or setgenerate calls)\n" |
|
|
|
" \"localsolps\": xxx.xxxxx (numeric) The average local solution rate in Sol/s since this node was started\n" |
|
|
|
" \"networksolps\": x (numeric) The estimated network solution rate in Sol/s\n" |
|
|
|
" \"pooledtx\": n (numeric) The size of the mem pool\n" |
|
|
|
" \"testnet\": true|false (boolean) If using testnet or not\n" |
|
|
|
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n" |
|
|
@ -294,7 +337,9 @@ Value getmininginfo(const Array& params, bool fHelp) |
|
|
|
obj.push_back(Pair("difficulty", (double)GetNetworkDifficulty())); |
|
|
|
obj.push_back(Pair("errors", GetWarnings("statusbar"))); |
|
|
|
obj.push_back(Pair("genproclimit", (int)GetArg("-genproclimit", -1))); |
|
|
|
obj.push_back(Pair("networkhashps", getnetworkhashps(params, false))); |
|
|
|
obj.push_back(Pair("localsolps" , getlocalsolps(params, false))); |
|
|
|
obj.push_back(Pair("networksolps", getnetworksolps(params, false))); |
|
|
|
obj.push_back(Pair("networkhashps", getnetworksolps(params, false))); |
|
|
|
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size())); |
|
|
|
obj.push_back(Pair("testnet", Params().TestnetToBeDeprecatedFieldRPC())); |
|
|
|
obj.push_back(Pair("chain", Params().NetworkIDString())); |
|
|
|