mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #10858: [RPC] Add "errors" field to getblockchaininfo and unify "errors" field in get*info RPCs
395cef7
Change getmininginfo errors field to warnings (Andrew Chow)8502b20
Unify help text for GetWarnings output in get*info RPCs (Andrew Chow)f77f0e4
Add warnings field to getblockchaininfo (Andrew Chow) Pull request description: The `getblockchaininfo` output does not contain the `errors` field which the `getinfo`, `getmininginfo`, and `getnetworkinfo` RPCs have. It should have it as the errors pertain to the blockchain. This PR adds that field. This PR also unifies the help text for the `errors` field and its output position so that all of the `get*info` commands are consistent. `getnetworkinfo`'s `errors` field is named `warnings`. I did not change this even though it is inconsistent since this naming has been in use for a long time. Tree-SHA512: 385ab6acfee67fc8816f4d51ab2bd7a623264c7973906dfbab0a171f199e9db16fde19093a5bc3dfbdd4ff5f19d2186b646eb6b3bae0a4d7c9add43650a4a9d9
This commit is contained in:
parent
4af8db6d33
commit
a287d84b82
@ -27,6 +27,7 @@
|
||||
#include "util.h"
|
||||
#include "utilstrencodings.h"
|
||||
#include "hash.h"
|
||||
#include "warnings.h"
|
||||
|
||||
#include "evo/specialtx.h"
|
||||
#include "evo/cbtx.h"
|
||||
@ -1428,6 +1429,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
|
||||
" }\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" \"warnings\" : \"...\", (string) any network and blockchain warnings.\n"
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("getblockchaininfo", "")
|
||||
@ -1472,6 +1474,7 @@ UniValue getblockchaininfo(const JSONRPCRequest& request)
|
||||
|
||||
obj.push_back(Pair("pruneheight", block->nHeight));
|
||||
}
|
||||
obj.push_back(Pair("warnings", GetWarnings("statusbar")));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -210,10 +210,11 @@ UniValue getmininginfo(const JSONRPCRequest& request)
|
||||
" \"currentblocksize\": nnn, (numeric) The last block size\n"
|
||||
" \"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", "")
|
||||
@ -228,10 +229,14 @@ UniValue getmininginfo(const JSONRPCRequest& request)
|
||||
obj.push_back(Pair("currentblocksize", (uint64_t)nLastBlockSize));
|
||||
obj.push_back(Pair("currentblocktx", (uint64_t)nLastBlockTx));
|
||||
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
|
||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||
obj.push_back(Pair("networkhashps", getnetworkhashps(request)));
|
||||
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
|
||||
obj.push_back(Pair("chain", Params().NetworkIDString()));
|
||||
if (IsDeprecatedRPCEnabled("getmininginfo")) {
|
||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||
} else {
|
||||
obj.push_back(Pair("warnings", GetWarnings("statusbar")));
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -457,7 +457,7 @@ UniValue getnetworkinfo(const JSONRPCRequest& request)
|
||||
" }\n"
|
||||
" ,...\n"
|
||||
" ]\n"
|
||||
" \"warnings\": \"...\" (string) any network warnings\n"
|
||||
" \"warnings\": \"...\" (string) any network and blockchain warnings\n"
|
||||
"}\n"
|
||||
"\nExamples:\n"
|
||||
+ HelpExampleCli("getnetworkinfo", "")
|
||||
|
@ -60,6 +60,7 @@ class BlockchainTest(BitcoinTestFramework):
|
||||
'pruned',
|
||||
'softforks',
|
||||
'verificationprogress',
|
||||
'warnings',
|
||||
]
|
||||
res = self.nodes[0].getblockchaininfo()
|
||||
# result should have pruneheight and default keys if pruning is enabled
|
||||
|
@ -84,7 +84,7 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
||||
# Check that we're not getting any versionbit-related errors in
|
||||
# get*info()
|
||||
assert(not VB_PATTERN.match(self.nodes[0].getinfo()["errors"]))
|
||||
assert(not VB_PATTERN.match(self.nodes[0].getmininginfo()["errors"]))
|
||||
assert(not VB_PATTERN.match(self.nodes[0].getmininginfo()["warnings"]))
|
||||
assert(not VB_PATTERN.match(self.nodes[0].getnetworkinfo()["warnings"]))
|
||||
|
||||
# 3. Now build one period of blocks with >= VB_THRESHOLD blocks signaling
|
||||
@ -96,7 +96,7 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
||||
# being of unexpected version.
|
||||
# Check that get*info() shows some kind of error.
|
||||
assert(WARN_UNKNOWN_RULES_MINED in self.nodes[0].getinfo()["errors"])
|
||||
assert(WARN_UNKNOWN_RULES_MINED in self.nodes[0].getmininginfo()["errors"])
|
||||
assert(WARN_UNKNOWN_RULES_MINED in self.nodes[0].getmininginfo()["warnings"])
|
||||
assert(WARN_UNKNOWN_RULES_MINED in self.nodes[0].getnetworkinfo()["warnings"])
|
||||
|
||||
# Mine a period worth of expected blocks so the generic block-version warning
|
||||
@ -117,7 +117,7 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
||||
# Connecting one block should be enough to generate an error.
|
||||
self.nodes[0].generate(1)
|
||||
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getinfo()["errors"])
|
||||
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getmininginfo()["errors"])
|
||||
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getmininginfo()["warnings"])
|
||||
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getnetworkinfo()["warnings"])
|
||||
self.stop_nodes()
|
||||
self.test_versionbits_in_alert_file()
|
||||
|
Loading…
Reference in New Issue
Block a user