Skip to content

Commit 395cef7

Browse files
committed
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
1 parent 8502b20 commit 395cef7

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/rpc/mining.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ UniValue getmininginfo(const JSONRPCRequest& request)
202202
" \"networkhashps\": nnn, (numeric) The network hashes per second\n"
203203
" \"pooledtx\": n (numeric) The size of the mempool\n"
204204
" \"chain\": \"xxxx\", (string) current network name as defined in BIP70 (main, test, regtest)\n"
205-
" \"errors\": \"...\" (string) (string) any network and blockchain warnings\n"
205+
" \"warnings\": \"...\" (string) any network and blockchain warnings\n"
206+
" \"errors\": \"...\" (string) DEPRECATED. Same as warnings. Only shown when bitcoind is started with -deprecatedrpc=getmininginfo\n"
206207
"}\n"
207208
"\nExamples:\n"
208209
+ HelpExampleCli("getmininginfo", "")
@@ -220,7 +221,11 @@ UniValue getmininginfo(const JSONRPCRequest& request)
220221
obj.push_back(Pair("networkhashps", getnetworkhashps(request)));
221222
obj.push_back(Pair("pooledtx", (uint64_t)mempool.size()));
222223
obj.push_back(Pair("chain", Params().NetworkIDString()));
223-
obj.push_back(Pair("errors", GetWarnings("statusbar")));
224+
if (IsDeprecatedRPCEnabled("getmininginfo")) {
225+
obj.push_back(Pair("errors", GetWarnings("statusbar")));
226+
} else {
227+
obj.push_back(Pair("warnings", GetWarnings("statusbar")));
228+
}
224229
return obj;
225230
}
226231

test/functional/p2p-versionbits-warning.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def run_test(self):
8787
self.nodes[0].generate(VB_PERIOD - VB_THRESHOLD + 1)
8888
# Check that we're not getting any versionbit-related errors in
8989
# get*info()
90-
assert(not VB_PATTERN.match(self.nodes[0].getmininginfo()["errors"]))
90+
assert(not VB_PATTERN.match(self.nodes[0].getmininginfo()["warnings"]))
9191
assert(not VB_PATTERN.match(self.nodes[0].getnetworkinfo()["warnings"]))
9292

9393
# 3. Now build one period of blocks with >= VB_THRESHOLD blocks signaling
@@ -98,7 +98,7 @@ def run_test(self):
9898
# have gotten a different alert due to more than 51/100 blocks
9999
# being of unexpected version.
100100
# Check that get*info() shows some kind of error.
101-
assert(WARN_UNKNOWN_RULES_MINED in self.nodes[0].getmininginfo()["errors"])
101+
assert(WARN_UNKNOWN_RULES_MINED in self.nodes[0].getmininginfo()["warnings"])
102102
assert(WARN_UNKNOWN_RULES_MINED in self.nodes[0].getnetworkinfo()["warnings"])
103103

104104
# Mine a period worth of expected blocks so the generic block-version warning
@@ -113,7 +113,7 @@ def run_test(self):
113113

114114
# Connecting one block should be enough to generate an error.
115115
self.nodes[0].generate(1)
116-
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getmininginfo()["errors"])
116+
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getmininginfo()["warnings"])
117117
assert(WARN_UNKNOWN_RULES_ACTIVE in self.nodes[0].getnetworkinfo()["warnings"])
118118
self.stop_nodes()
119119
self.test_versionbits_in_alert_file()

0 commit comments

Comments
 (0)