Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 228 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 0) { | ||||
"\nReturns a json object containing mining-related information." | "\nReturns a json object containing mining-related information." | ||||
"\nResult:\n" | "\nResult:\n" | ||||
"{\n" | "{\n" | ||||
" \"blocks\": nnn, (numeric) The current block\n" | " \"blocks\": nnn, (numeric) The current block\n" | ||||
" \"currentblocksize\": nnn, (numeric) The last block size\n" | " \"currentblocksize\": nnn, (numeric) The last block size\n" | ||||
" \"currentblocktx\": nnn, (numeric) The last block " | " \"currentblocktx\": nnn, (numeric) The last block " | ||||
"transaction\n" | "transaction\n" | ||||
" \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n" | " \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n" | ||||
" \"errors\": \"...\" (string) Current errors\n" | |||||
" \"networkhashps\": nnn, (numeric) The network hashes per " | " \"networkhashps\": nnn, (numeric) The network hashes per " | ||||
"second\n" | "second\n" | ||||
" \"pooledtx\": n (numeric) The size of the mempool\n" | " \"pooledtx\": n (numeric) The size of the mempool\n" | ||||
" \"chain\": \"xxxx\", (string) current network name as " | " \"chain\": \"xxxx\", (string) current network name as " | ||||
"defined in BIP70 (main, test, regtest)\n" | "defined in BIP70 (main, test, regtest)\n" | ||||
" \"warnings\": \"...\" (string) any network and " | |||||
"blockchain warnings\n" | |||||
" \"errors\": \"...\" (string) DEPRECATED. Same as " | |||||
"warnings. Only shown when bitcoind is started with " | |||||
"-deprecatedrpc=getmininginfo\n" | |||||
"}\n" | "}\n" | ||||
"\nExamples:\n" + | "\nExamples:\n" + | ||||
HelpExampleCli("getmininginfo", "") + | HelpExampleCli("getmininginfo", "") + | ||||
HelpExampleRpc("getmininginfo", "")); | HelpExampleRpc("getmininginfo", "")); | ||||
} | } | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
UniValue obj(UniValue::VOBJ); | UniValue obj(UniValue::VOBJ); | ||||
obj.pushKV("blocks", int(chainActive.Height())); | obj.pushKV("blocks", int(chainActive.Height())); | ||||
obj.pushKV("currentblocksize", uint64_t(nLastBlockSize)); | obj.pushKV("currentblocksize", uint64_t(nLastBlockSize)); | ||||
obj.pushKV("currentblocktx", uint64_t(nLastBlockTx)); | obj.pushKV("currentblocktx", uint64_t(nLastBlockTx)); | ||||
obj.pushKV("difficulty", double(GetDifficulty(chainActive.Tip()))); | obj.pushKV("difficulty", double(GetDifficulty(chainActive.Tip()))); | ||||
obj.pushKV("blockprioritypercentage", | obj.pushKV("blockprioritypercentage", | ||||
uint8_t(gArgs.GetArg("-blockprioritypercentage", | uint8_t(gArgs.GetArg("-blockprioritypercentage", | ||||
DEFAULT_BLOCK_PRIORITY_PERCENTAGE))); | DEFAULT_BLOCK_PRIORITY_PERCENTAGE))); | ||||
obj.pushKV("errors", GetWarnings("statusbar")); | |||||
obj.pushKV("networkhashps", getnetworkhashps(config, request)); | obj.pushKV("networkhashps", getnetworkhashps(config, request)); | ||||
obj.pushKV("pooledtx", uint64_t(g_mempool.size())); | obj.pushKV("pooledtx", uint64_t(g_mempool.size())); | ||||
obj.pushKV("chain", config.GetChainParams().NetworkIDString()); | obj.pushKV("chain", config.GetChainParams().NetworkIDString()); | ||||
if (IsDeprecatedRPCEnabled(gArgs, "getmininginfo")) { | |||||
obj.pushKV("errors", GetWarnings("statusbar")); | |||||
} else { | |||||
obj.pushKV("warnings", GetWarnings("statusbar")); | |||||
} | |||||
return obj; | return obj; | ||||
} | } | ||||
// NOTE: Unlike wallet RPC (which use BCH values), mining RPCs follow GBT (BIP | // NOTE: Unlike wallet RPC (which use BCH values), mining RPCs follow GBT (BIP | ||||
// 22) in using satoshi amounts | // 22) in using satoshi amounts | ||||
static UniValue prioritisetransaction(const Config &config, | static UniValue prioritisetransaction(const Config &config, | ||||
const JSONRPCRequest &request) { | const JSONRPCRequest &request) { | ||||
if (request.fHelp || request.params.size() != 3) { | if (request.fHelp || request.params.size() != 3) { | ||||
▲ Show 20 Lines • Show All 551 Lines • Show Last 20 Lines |