diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -24,6 +24,7 @@ #include "util.h" #include "utilstrencodings.h" #include "validation.h" +#include "warnings.h" #include // boost::thread::interrupt @@ -1234,37 +1235,45 @@ "blockchain processing.\n" "\nResult:\n" "{\n" - " \"chain\": \"xxxx\", (string) current network name as " + " \"chain\": \"xxxx\", (string) current network name " + "as " "defined in BIP70 (main, test, regtest)\n" - " \"blocks\": xxxxxx, (numeric) the current number of " + " \"blocks\": xxxxxx, (numeric) the current number of " "blocks processed in the server\n" - " \"headers\": xxxxxx, (numeric) the current number of " + " \"headers\": xxxxxx, (numeric) the current number of " "headers we have validated\n" - " \"bestblockhash\": \"...\", (string) the hash of the currently " + " \"bestblockhash\": \"...\", (string) the hash of the " + "currently " "best block\n" - " \"difficulty\": xxxxxx, (numeric) the current difficulty\n" - " \"mediantime\": xxxxxx, (numeric) median time for the " + " \"difficulty\": xxxxxx, (numeric) the current " + "difficulty\n" + " \"mediantime\": xxxxxx, (numeric) median time for the " "current best block\n" " \"verificationprogress\": xxxx, (numeric) estimate of " "verification progress [0..1]\n" - " \"chainwork\": \"xxxx\" (string) total amount of work in " + " \"chainwork\": \"xxxx\" (string) total amount of work " + "in " "active chain, in hexadecimal\n" - " \"pruned\": xx, (boolean) if the blocks are subject " + " \"pruned\": xx, (boolean) if the blocks are " + "subject " "to pruning\n" - " \"pruneheight\": xxxxxx, (numeric) lowest-height complete " + " \"pruneheight\": xxxxxx, (numeric) lowest-height " + "complete " "block stored\n" - " \"softforks\": [ (array) status of softforks in " + " \"softforks\": [ (array) status of softforks in " "progress\n" " {\n" - " \"id\": \"xxxx\", (string) name of softfork\n" - " \"version\": xx, (numeric) block version\n" - " \"reject\": { (object) progress toward " + " \"id\": \"xxxx\", (string) name of softfork\n" + " \"version\": xx, (numeric) block version\n" + " \"reject\": { (object) progress toward " "rejecting pre-softfork blocks\n" - " \"status\": xx, (boolean) true if threshold " + " \"status\": xx, (boolean) true if threshold " "reached\n" " },\n" " }, ...\n" " ]\n" + " \"warnings\" : \"...\", (string) any network and " + "blockchain warnings.\n" "}\n" "\nExamples:\n" + HelpExampleCli("getblockchaininfo", "") + @@ -1304,6 +1313,7 @@ obj.pushKV("pruneheight", block->nHeight); } + obj.pushKV("warnings", GetWarnings("statusbar")); return obj; } diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -234,12 +234,16 @@ " \"currentblocktx\": nnn, (numeric) The last block " "transaction\n" " \"difficulty\": xxx.xxxxx (numeric) The current difficulty\n" - " \"errors\": \"...\" (string) Current errors\n" " \"networkhashps\": nnn, (numeric) The network hashes per " "second\n" " \"pooledtx\": n (numeric) The size of the mempool\n" " \"chain\": \"xxxx\", (string) current network name as " "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" "\nExamples:\n" + HelpExampleCli("getmininginfo", "") + @@ -256,10 +260,14 @@ obj.pushKV("blockprioritypercentage", uint8_t(gArgs.GetArg("-blockprioritypercentage", DEFAULT_BLOCK_PRIORITY_PERCENTAGE))); - obj.pushKV("errors", GetWarnings("statusbar")); obj.pushKV("networkhashps", getnetworkhashps(config, request)); obj.pushKV("pooledtx", uint64_t(g_mempool.size())); obj.pushKV("chain", config.GetChainParams().NetworkIDString()); + if (IsDeprecatedRPCEnabled(gArgs, "getmininginfo")) { + obj.pushKV("errors", GetWarnings("statusbar")); + } else { + obj.pushKV("warnings", GetWarnings("statusbar")); + } return obj; } diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -563,8 +563,8 @@ " }\n" " ,...\n" " ]\n" - " \"warnings\": \"...\" " - "(string) any network warnings\n" + " \"warnings\": \"...\" (string) any network " + "and blockchain warnings\n" "}\n" "\nExamples:\n" + HelpExampleCli("getnetworkinfo", "") + diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -63,6 +63,7 @@ 'pruned', 'softforks', 'verificationprogress', + 'warnings', ] res = self.nodes[0].getblockchaininfo() # result should have pruneheight and default keys if pruning is enabled