Skip to content

Commit 49e5f3f

Browse files
committed
rpc: Add deprecation error for getinfo
Add a short informative deprecation message when users use `getinfo`, that points them to the new calls where to get the different information fields.
1 parent 66e3af7 commit 49e5f3f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/rpc/misc.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,18 @@ UniValue echo(const JSONRPCRequest& request)
668668
return request.params;
669669
}
670670

671+
static UniValue getinfo_deprecated(const JSONRPCRequest& request)
672+
{
673+
throw JSONRPCError(RPC_METHOD_NOT_FOUND,
674+
"getinfo\n"
675+
"\nThis call was removed in version 0.16.0. Use the appropriate fields from:\n"
676+
"- getblockchaininfo: blocks, difficulty, chain\n"
677+
"- getnetworkinfo: version, protocolversion, timeoffset, connections, proxy, relayfee, warnings\n"
678+
"- getwalletinfo: balance, keypoololdest, keypoolsize, paytxfee, unlocked_until, walletversion\n"
679+
"\nbitcoin-cli has the option -getinfo to collect and format these in the old format."
680+
);
681+
}
682+
671683
static const CRPCCommand commands[] =
672684
{ // category name actor (function) argNames
673685
// --------------------- ------------------------ ----------------------- ----------
@@ -682,6 +694,7 @@ static const CRPCCommand commands[] =
682694
{ "hidden", "setmocktime", &setmocktime, {"timestamp"}},
683695
{ "hidden", "echo", &echo, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
684696
{ "hidden", "echojson", &echo, {"arg0","arg1","arg2","arg3","arg4","arg5","arg6","arg7","arg8","arg9"}},
697+
{ "hidden", "getinfo", &getinfo_deprecated, {}},
685698
};
686699

687700
void RegisterMiscRPCCommands(CRPCTable &t)

0 commit comments

Comments
 (0)