mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Change getmininginfo errors field to warnings
Changes the errors field to warnings. To maintain compatibility, the errors field is deprecated and enabled by starting bitcoind with -deprecatedrpc=getmininginfo
This commit is contained in:
parent
8502b20852
commit
395cef7601
@ -202,7 +202,8 @@ UniValue getmininginfo(const JSONRPCRequest& request)
|
|||||||
" \"networkhashps\": nnn, (numeric) The network hashes per second\n"
|
" \"networkhashps\": nnn, (numeric) The network hashes per 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 defined in BIP70 (main, test, regtest)\n"
|
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
|
||||||
" \"errors\": \"...\" (string) (string) any network and blockchain warnings\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", "")
|
||||||
@ -220,7 +221,11 @@ UniValue getmininginfo(const JSONRPCRequest& request)
|
|||||||
obj.push_back(Pair("networkhashps", getnetworkhashps(request)));
|
obj.push_back(Pair("networkhashps", getnetworkhashps(request)));
|
||||||
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
|
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
|
||||||
obj.push_back(Pair("chain", Params().NetworkIDString()));
|
obj.push_back(Pair("chain", Params().NetworkIDString()));
|
||||||
|
if (IsDeprecatedRPCEnabled("getmininginfo")) {
|
||||||
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
obj.push_back(Pair("errors", GetWarnings("statusbar")));
|
||||||
|
} else {
|
||||||
|
obj.push_back(Pair("warnings", GetWarnings("statusbar")));
|
||||||
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
|||||||
self.nodes[0].generate(VB_PERIOD - VB_THRESHOLD + 1)
|
self.nodes[0].generate(VB_PERIOD - VB_THRESHOLD + 1)
|
||||||
# Check that we're not getting any versionbit-related errors in
|
# Check that we're not getting any versionbit-related errors in
|
||||||
# get*info()
|
# get*info()
|
||||||
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"]))
|
assert(not VB_PATTERN.match(self.nodes[0].getnetworkinfo()["warnings"]))
|
||||||
|
|
||||||
# 3. Now build one period of blocks with >= VB_THRESHOLD blocks signaling
|
# 3. Now build one period of blocks with >= VB_THRESHOLD blocks signaling
|
||||||
@ -98,7 +98,7 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
|||||||
# have gotten a different alert due to more than 51/100 blocks
|
# have gotten a different alert due to more than 51/100 blocks
|
||||||
# being of unexpected version.
|
# being of unexpected version.
|
||||||
# Check that get*info() shows some kind of error.
|
# Check that get*info() shows some kind of error.
|
||||||
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"])
|
assert(WARN_UNKNOWN_RULES_MINED in self.nodes[0].getnetworkinfo()["warnings"])
|
||||||
|
|
||||||
# Mine a period worth of expected blocks so the generic block-version warning
|
# Mine a period worth of expected blocks so the generic block-version warning
|
||||||
@ -113,7 +113,7 @@ class VersionBitsWarningTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
# Connecting one block should be enough to generate an error.
|
# Connecting one block should be enough to generate an error.
|
||||||
self.nodes[0].generate(1)
|
self.nodes[0].generate(1)
|
||||||
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"])
|
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getnetworkinfo()["warnings"])
|
||||||
self.stop_nodes()
|
self.stop_nodes()
|
||||||
self.test_versionbits_in_alert_file()
|
self.test_versionbits_in_alert_file()
|
||||||
|
Loading…
Reference in New Issue
Block a user