Merge #10857: [RPC] Add a deprecation warning to getinfo's output

1c9b818 getinfo deprecation warning (Andrew Chow)

Pull request description:

  This is an alternative to #10841

  This PR implements @gmaxwell's suggestion of a `nag` field for getinfo which warns about the deprecation. Instead of calling it `nag`, I have named it `deprecation-warning`. The output of `getinfo` will look like this:
  ```
  {
    "version": 149900,
    "protocolversion": 70015,
    "walletversion": 139900,
    "balance": 0.00000000,
    "blocks": 476281,
    "timeoffset": 0,
    "connections": 2,
    "proxy": "",
    "difficulty": 804525194568.1318,
    "testnet": false,
    "keypoololdest": 1496858803,
    "keypoolsize": 197,
    "unlocked_until": 0,
    "paytxfee": 0.00000000,
    "relayfee": 0.00001000,
    "errors": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications",
    "deprecation-warning": "WARNING: getinfo is deprecated and will be fully removed in 0.16. Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16"
  }
  ```

  I think this should be tagged for 0.15

Tree-SHA512: ea1bac96a67f797519e8748ddd661cf0a1127cbc38f145b98f10cf9b54dcf0519b353062ce9888e1f51875497299c75ff5147566944451bc3fc117620e773489
This commit is contained in:
Wladimir J. van der Laan 2017-07-19 16:56:03 +02:00 committed by Pasta
parent 2ada45284b
commit b535dfbc41
No known key found for this signature in database
GPG Key ID: D362C9F7142766AE

View File

@ -58,6 +58,7 @@ UniValue getinfo(const JSONRPCRequest& request)
"\nDEPRECATED. Returns an object containing various state info.\n" "\nDEPRECATED. Returns an object containing various state info.\n"
"\nResult:\n" "\nResult:\n"
"{\n" "{\n"
" \"deprecation-warning\": \"...\" (string) warning that the getinfo command is deprecated and will be removed in 0.16\n"
" \"version\": xxxxx, (numeric) the server version\n" " \"version\": xxxxx, (numeric) the server version\n"
" \"protocolversion\": xxxxx, (numeric) the protocol version\n" " \"protocolversion\": xxxxx, (numeric) the protocol version\n"
" \"walletversion\": xxxxx, (numeric) the wallet version\n" " \"walletversion\": xxxxx, (numeric) the wallet version\n"
@ -93,6 +94,8 @@ UniValue getinfo(const JSONRPCRequest& request)
GetProxy(NET_IPV4, proxy); GetProxy(NET_IPV4, proxy);
UniValue obj(UniValue::VOBJ); UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("deprecation-warning", "WARNING: getinfo is deprecated and will be fully removed in 0.16."
" Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16"));
obj.push_back(Pair("version", CLIENT_VERSION)); obj.push_back(Pair("version", CLIENT_VERSION));
obj.push_back(Pair("protocolversion", PROTOCOL_VERSION)); obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET