@@ -93,44 +93,75 @@ UniValue privatesend(const JSONRPCRequest& request)
9393
9494UniValue getpoolinfo (const JSONRPCRequest& request)
9595{
96- if (request.fHelp || request.params .size () != 0 )
97- throw std::runtime_error (
98- " getpoolinfo\n "
99- " Returns an object containing mixing pool related information.\n " );
96+ throw std::runtime_error (
97+ " getpoolinfo\n "
98+ " DEPRECATED. Please use getprivatesendinfo instead.\n "
99+ );
100+ }
100101
101- #ifdef ENABLE_WALLET
102- CPrivateSendBaseManager* pprivateSendBaseManager = fMasternodeMode ? (CPrivateSendBaseManager*)&privateSendServer : (CPrivateSendBaseManager*)&privateSendClient;
102+ UniValue getprivatesendinfo (const JSONRPCRequest& request)
103+ {
104+ if (request.fHelp || request.params .size () != 0 ) {
105+ throw std::runtime_error (
106+ " getprivatesendinfo\n "
107+ " Returns an object containing an information about PrivateSend settings and state.\n "
108+ " \n Result (for regular nodes):\n "
109+ " {\n "
110+ " \" enabled\" : true|false, (bool) Whether mixing functionality is enabled\n "
111+ " \" running\" : true|false, (bool) Whether mixing is currently running\n "
112+ " \" multisession\" : true|false, (bool) Whether PrivateSend Multisession option is enabled\n "
113+ " \" max_sessions\" : xxx, (numeric) How many parallel mixing sessions can there be at once\n "
114+ " \" max_rounds\" : xxx, (numeric) How many rounds to mix\n "
115+ " \" max_amount\" : xxx, (numeric) How many " + CURRENCY_UNIT + " to keep anonimized\n "
116+ " \" max_denoms\" : xxx, (numeric) How many inputs of each denominated amount to create\n "
117+ " \" queue_size\" : xxx, (numeric) How many queues there are currently on the network\n "
118+ " \" sessions\" : (array of json objects)\n "
119+ " [\n "
120+ " {\n "
121+ " \" protxhash\" : \" ...\" , (string) The ProTxHash of the masternode\n "
122+ " \" outpoint\" : \" txid-index\" , (string) The outpoint of the masternode\n "
123+ " \" service\" : \" host:port\" , (string) The IP address and port of the masternode\n "
124+ " \" denomination\" : xxx, (numeric) The denomination of the mixing session in " + CURRENCY_UNIT + " \n "
125+ " \" state\" : \" ...\" , (string) Current state of the mixing session\n "
126+ " \" entries_count\" : xxx, (numeric) The number of entries in the mixing session\n "
127+ " }\n "
128+ " ,...\n "
129+ " ],\n "
130+ " \" keys_left\" : xxx, (numeric) How many new keys are left since last automatic backup\n "
131+ " \" warnings\" : \" ...\" (string) Warnings if any\n "
132+ " }\n "
133+ " \n Result (for masternodes):\n "
134+ " {\n "
135+ " \" queue_size\" : xxx, (numeric) How many queues there are currently on the network\n "
136+ " \" denomination\" : xxx, (numeric) The denomination of the mixing session in " + CURRENCY_UNIT + " \n "
137+ " \" state\" : \" ...\" , (string) Current state of the mixing session\n "
138+ " \" entries_count\" : xxx, (numeric) The number of entries in the mixing session\n "
139+ " }\n "
140+ " \n Examples:\n "
141+ + HelpExampleCli (" getprivatesendinfo" , " " )
142+ + HelpExampleRpc (" getprivatesendinfo" , " " )
143+ );
144+ }
103145
104146 UniValue obj (UniValue::VOBJ);
105- // TODO:
106- // obj.push_back(Pair("state", pprivateSendBase->GetStateString()));
107- obj.push_back (Pair (" queue" , pprivateSendBaseManager->GetQueueSize ()));
108- // obj.push_back(Pair("entries", pprivateSendBase->GetEntriesCount()));
109- obj.push_back (Pair (" status" , privateSendClient.GetStatuses ()));
110-
111- std::vector<CDeterministicMNCPtr> vecDmns;
112- if (privateSendClient.GetMixingMasternodesInfo (vecDmns)) {
113- UniValue pools (UniValue::VARR);
114- for (const auto & dmn : vecDmns) {
115- UniValue pool (UniValue::VOBJ);
116- pool.push_back (Pair (" outpoint" , dmn->collateralOutpoint .ToStringShort ()));
117- pool.push_back (Pair (" addr" , dmn->pdmnState ->addr .ToString ()));
118- pools.push_back (pool);
119- }
120- obj.push_back (Pair (" pools" , pools));
147+
148+ if (fMasternodeMode ) {
149+ privateSendServer.GetJsonInfo (obj);
150+ return obj;
121151 }
122152
153+
154+ #ifdef ENABLE_WALLET
155+ privateSendClient.GetJsonInfo (obj);
156+
123157 CWallet* const pwallet = GetWalletForJSONRPCRequest (request);
124- if (pwallet) {
125- obj.push_back (Pair (" keys_left" , pwallet->nKeysLeftSinceAutoBackup ));
126- obj.push_back (Pair (" warnings" , pwallet->nKeysLeftSinceAutoBackup < PRIVATESEND_KEYS_THRESHOLD_WARNING
127- ? " WARNING: keypool is almost depleted!" : " " ));
158+ if (!pwallet) {
159+ return obj;
128160 }
129- #else // ENABLE_WALLET
130- UniValue obj (UniValue::VOBJ);
131- obj.push_back (Pair (" state" , privateSendServer.GetStateString ()));
132- obj.push_back (Pair (" queue" , privateSendServer.GetQueueSize ()));
133- obj.push_back (Pair (" entries" , privateSendServer.GetEntriesCount ()));
161+
162+ obj.push_back (Pair (" keys_left" , pwallet->nKeysLeftSinceAutoBackup ));
163+ obj.push_back (Pair (" warnings" , pwallet->nKeysLeftSinceAutoBackup < PRIVATESEND_KEYS_THRESHOLD_WARNING
164+ ? " WARNING: keypool is almost depleted!" : " " ));
134165#endif // ENABLE_WALLET
135166
136167 return obj;
@@ -635,6 +666,7 @@ static const CRPCCommand commands[] =
635666 { " dash" , " masternode" , &masternode, true , {} },
636667 { " dash" , " masternodelist" , &masternodelist, true , {} },
637668 { " dash" , " getpoolinfo" , &getpoolinfo, true , {} },
669+ { " dash" , " getprivatesendinfo" , &getprivatesendinfo, true , {} },
638670#ifdef ENABLE_WALLET
639671 { " dash" , " privatesend" , &privatesend, false , {} },
640672#endif // ENABLE_WALLET
0 commit comments