| 96 | } |
| 97 | |
| 98 | Value getmininginfo(const Array& params, bool fHelp) { |
| 99 | if (fHelp || params.size() != 0) { |
| 100 | throw runtime_error( |
| 101 | "getmininginfo\n" |
| 102 | "\nReturns a json object containing mining-related information." |
| 103 | "\nResult:\n" |
| 104 | "{\n" |
| 105 | " \"blocks\": nnn, (numeric) The current block\n" |
| 106 | " \"currentblocksize\": nnn, (numeric) The last block size\n" |
| 107 | " \"currentblocktx\": nnn, (numeric) The last block transaction\n" |
| 108 | " \"errors\": \"...\" (string) Current errors\n" |
| 109 | " \"generate\": true|false (boolean) If the generation is on or off (see getgenerate or setgenerate " |
| 110 | "calls)\n" |
| 111 | " \"pooledtx\": n (numeric) The size of the mem pool\n" |
| 112 | " \"testnet\": true|false (boolean) If using testnet or not\n" |
| 113 | "}\n" |
| 114 | "\nExamples:\n" + |
| 115 | HelpExampleCli("getmininginfo", "") + "\nAs json rpc call\n" + HelpExampleRpc("getmininginfo", "")); |
| 116 | } |
| 117 | |
| 118 | Object obj; |
| 119 | obj.push_back(Pair("blocks", chainActive.Height())); |
| 120 | obj.push_back(Pair("currentblocksize", (uint64_t)nLastBlockSize)); |
| 121 | obj.push_back(Pair("currentblocktx", (uint64_t)nLastBlockTx)); |
| 122 | obj.push_back(Pair("errors", GetWarnings("statusbar"))); |
| 123 | obj.push_back(Pair("genblocklimit", 1)); |
| 124 | obj.push_back(Pair("pooledtx", (uint64_t)mempool.Size())); |
| 125 | obj.push_back(Pair("nettype", NetTypeNames[SysCfg().NetworkID()])); |
| 126 | obj.push_back(Pair("posmaxnonce", (int32_t)SysCfg().GetBlockMaxNonce())); |
| 127 | obj.push_back(Pair("generate", GetMiningInfo())); |
| 128 | return obj; |
| 129 | } |
| 130 | |
| 131 | Value submitblock(const Array& params, bool fHelp) { |
| 132 | if (fHelp || params.size() < 1 || params.size() > 2) |
nothing calls this directly
no test coverage detected