|
31 | 31 |
|
32 | 32 | #include <univalue.h> |
33 | 33 |
|
34 | | -/** |
35 | | - * @note Do not add or change anything in the information returned by this |
36 | | - * method. `getinfo` exists for backwards-compatibility only. It combines |
37 | | - * information from wildly different sources in the program, which is a mess, |
38 | | - * and is thus planned to be deprecated eventually. |
39 | | - * |
40 | | - * Based on the source of the information, new information should be added to: |
41 | | - * - `getblockchaininfo`, |
42 | | - * - `getnetworkinfo` or |
43 | | - * - `getwalletinfo` |
44 | | - * |
45 | | - * Or alternatively, create a specific query method for the information. |
46 | | - **/ |
47 | | -UniValue getinfo(const JSONRPCRequest& request) |
48 | | -{ |
49 | | - if (request.fHelp || request.params.size() != 0) |
50 | | - throw std::runtime_error( |
51 | | - "getinfo\n" |
52 | | - "\nDEPRECATED. Returns an object containing various state info.\n" |
53 | | - "\nResult:\n" |
54 | | - "{\n" |
55 | | - " \"deprecation-warning\": \"...\" (string) warning that the getinfo command is deprecated and will be removed in 0.16\n" |
56 | | - " \"version\": xxxxx, (numeric) the server version\n" |
57 | | - " \"protocolversion\": xxxxx, (numeric) the protocol version\n" |
58 | | - " \"walletversion\": xxxxx, (numeric) the wallet version\n" |
59 | | - " \"balance\": xxxxxxx, (numeric) the total bitcoin balance of the wallet\n" |
60 | | - " \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n" |
61 | | - " \"timeoffset\": xxxxx, (numeric) the time offset\n" |
62 | | - " \"connections\": xxxxx, (numeric) the number of connections\n" |
63 | | - " \"proxy\": \"host:port\", (string, optional) the proxy used by the server\n" |
64 | | - " \"difficulty\": xxxxxx, (numeric) the current difficulty\n" |
65 | | - " \"testnet\": true|false, (boolean) if the server is using testnet or not\n" |
66 | | - " \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since Unix epoch) of the oldest pre-generated key in the key pool\n" |
67 | | - " \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated\n" |
68 | | - " \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n" |
69 | | - " \"paytxfee\": x.xxxx, (numeric) the transaction fee set in " + CURRENCY_UNIT + "/kB\n" |
70 | | - " \"relayfee\": x.xxxx, (numeric) minimum relay fee for transactions in " + CURRENCY_UNIT + "/kB\n" |
71 | | - " \"errors\": \"...\" (string) any error messages\n" |
72 | | - "}\n" |
73 | | - "\nExamples:\n" |
74 | | - + HelpExampleCli("getinfo", "") |
75 | | - + HelpExampleRpc("getinfo", "") |
76 | | - ); |
77 | | - |
78 | | -#ifdef ENABLE_WALLET |
79 | | - CWallet * const pwallet = GetWalletForJSONRPCRequest(request); |
80 | | - |
81 | | - LOCK2(cs_main, pwallet ? &pwallet->cs_wallet : nullptr); |
82 | | -#else |
83 | | - LOCK(cs_main); |
84 | | -#endif |
85 | | - |
86 | | - proxyType proxy; |
87 | | - GetProxy(NET_IPV4, proxy); |
88 | | - |
89 | | - UniValue obj(UniValue::VOBJ); |
90 | | - obj.push_back(Pair("deprecation-warning", "WARNING: getinfo is deprecated and will be fully removed in 0.16." |
91 | | - " Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16")); |
92 | | - obj.push_back(Pair("version", CLIENT_VERSION)); |
93 | | - obj.push_back(Pair("protocolversion", PROTOCOL_VERSION)); |
94 | | -#ifdef ENABLE_WALLET |
95 | | - if (pwallet) { |
96 | | - obj.push_back(Pair("walletversion", pwallet->GetVersion())); |
97 | | - obj.push_back(Pair("balance", ValueFromAmount(pwallet->GetBalance()))); |
98 | | - } |
99 | | -#endif |
100 | | - obj.push_back(Pair("blocks", (int)chainActive.Height())); |
101 | | - obj.push_back(Pair("timeoffset", GetTimeOffset())); |
102 | | - if(g_connman) |
103 | | - obj.push_back(Pair("connections", (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL))); |
104 | | - obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.proxy.ToStringIPPort() : std::string()))); |
105 | | - obj.push_back(Pair("difficulty", (double)GetDifficulty())); |
106 | | - obj.push_back(Pair("testnet", Params().NetworkIDString() == CBaseChainParams::TESTNET)); |
107 | | -#ifdef ENABLE_WALLET |
108 | | - if (pwallet) { |
109 | | - obj.push_back(Pair("keypoololdest", pwallet->GetOldestKeyPoolTime())); |
110 | | - obj.push_back(Pair("keypoolsize", (int)pwallet->GetKeyPoolSize())); |
111 | | - } |
112 | | - if (pwallet && pwallet->IsCrypted()) { |
113 | | - obj.push_back(Pair("unlocked_until", pwallet->nRelockTime)); |
114 | | - } |
115 | | - obj.push_back(Pair("paytxfee", ValueFromAmount(payTxFee.GetFeePerK()))); |
116 | | -#endif |
117 | | - obj.push_back(Pair("relayfee", ValueFromAmount(::minRelayTxFee.GetFeePerK()))); |
118 | | - obj.push_back(Pair("errors", GetWarnings("statusbar"))); |
119 | | - return obj; |
120 | | -} |
121 | | - |
122 | 34 | #ifdef ENABLE_WALLET |
123 | 35 | class DescribeAddressVisitor : public boost::static_visitor<UniValue> |
124 | 36 | { |
@@ -651,7 +563,6 @@ UniValue echo(const JSONRPCRequest& request) |
651 | 563 | static const CRPCCommand commands[] = |
652 | 564 | { // category name actor (function) okSafeMode |
653 | 565 | // --------------------- ------------------------ ----------------------- ---------- |
654 | | - { "control", "getinfo", &getinfo, true, {} }, /* uses wallet if enabled */ |
655 | 566 | { "control", "getmemoryinfo", &getmemoryinfo, true, {"mode"} }, |
656 | 567 | { "util", "validateaddress", &validateaddress, true, {"address"} }, /* uses wallet if enabled */ |
657 | 568 | { "util", "createmultisig", &createmultisig, true, {"nrequired","keys"} }, |
|
0 commit comments