MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / getmininginfo

Function getmininginfo

src/rpc/mining.cpp:251–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251static UniValue getmininginfo(const JSONRPCRequest& request)
252{
253 if (request.fHelp || request.params.size() != 0)
254 throw std::runtime_error(
255 "getmininginfo\n"
256 "\nReturns a json object containing mining-related information."
257 "\nResult:\n"
258 "{\n"
259 " \"blocks\": nnn, (numeric) The current block\n"
260 " \"currentblockweight\": nnn, (numeric) The last block weight\n"
261 " \"currentblocktx\": nnn, (numeric) The last block transaction\n"
262 " \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n"
263 " \"networkhashps\": nnn, (numeric) The network hashes per second\n"
264 " \"pooledtx\": n (numeric) The size of the mempool\n"
265 " \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
266 " \"warnings\": \"...\" (string) any network and blockchain warnings\n"
267 "}\n"
268 "\nExamples:\n"
269 + HelpExampleCli("getmininginfo", "")
270 + HelpExampleRpc("getmininginfo", "")
271 );
272
273
274 LOCK(cs_main);
275
276 UniValue obj(UniValue::VOBJ);
277 obj.pushKV("blocks", (int)chainActive.Height());
278 obj.pushKV("currentblockweight", (uint64_t)nLastBlockWeight);
279 obj.pushKV("currentblocktx", (uint64_t)nLastBlockTx);
280 obj.pushKV("difficulty", (double)GetDifficulty(chainActive.Tip()));
281 obj.pushKV("networkhashps", getnetworkhashps(request));
282 obj.pushKV("pooledtx", (uint64_t)mempool.size());
283 obj.pushKV("chain", Params().NetworkIDString());
284 obj.pushKV("warnings", GetWarnings("statusbar"));
285 return obj;
286}
287
288
289// NOTE: Unlike wallet RPC (which use BTG values), mining RPCs follow GBT (BIP 22) in using satoshi amounts

Callers

nothing calls this directly

Calls 11

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
GetDifficultyFunction · 0.85
getnetworkhashpsFunction · 0.85
GetWarningsFunction · 0.85
HeightMethod · 0.80
NetworkIDStringMethod · 0.80
ParamsClass · 0.50
sizeMethod · 0.45
pushKVMethod · 0.45
TipMethod · 0.45

Tested by

no test coverage detected