|
8 | 8 | #include "init.h" |
9 | 9 | #include "netbase.h" |
10 | 10 | #include "validation.h" |
11 | | -#include "masternode/masternode-payments.h" |
12 | | -#include "masternode/masternode-sync.h" |
13 | | -#ifdef ENABLE_WALLET |
14 | | -#include "privatesend/privatesend-client.h" |
15 | | -#endif // ENABLE_WALLET |
16 | | -#include "privatesend/privatesend-server.h" |
17 | | -#include "rpc/server.h" |
18 | 11 | #include "util.h" |
19 | 12 | #include "utilmoneystr.h" |
20 | 13 | #include "txmempool.h" |
21 | 14 |
|
22 | | -#include "wallet/coincontrol.h" |
23 | | -#include "wallet/rpcwallet.h" |
24 | | - |
25 | 15 | #include "evo/specialtx.h" |
26 | 16 | #include "evo/deterministicmns.h" |
27 | 17 |
|
28 | | -#include <fstream> |
29 | | -#include <iomanip> |
30 | | -#include <univalue.h> |
| 18 | +#include "masternode/masternode-payments.h" |
| 19 | +#include "masternode/masternode-sync.h" |
31 | 20 |
|
32 | | -UniValue masternodelist(const JSONRPCRequest& request); |
| 21 | +#include "rpc/server.h" |
33 | 22 |
|
| 23 | +#include "wallet/coincontrol.h" |
| 24 | +#include "wallet/rpcwallet.h" |
34 | 25 | #ifdef ENABLE_WALLET |
35 | | -UniValue privatesend(const JSONRPCRequest& request) |
36 | | -{ |
37 | | - CWallet* const pwallet = GetWalletForJSONRPCRequest(request); |
38 | | - if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) |
39 | | - return NullUniValue; |
40 | | - |
41 | | - if (request.fHelp || request.params.size() != 1) |
42 | | - throw std::runtime_error( |
43 | | - "privatesend \"command\"\n" |
44 | | - "\nArguments:\n" |
45 | | - "1. \"command\" (string or set of strings, required) The command to execute\n" |
46 | | - "\nAvailable commands:\n" |
47 | | - " start - Start mixing\n" |
48 | | - " stop - Stop mixing\n" |
49 | | - " reset - Reset mixing\n" |
50 | | - ); |
51 | | - |
52 | | - if (fMasternodeMode) |
53 | | - throw JSONRPCError(RPC_INTERNAL_ERROR, "Client-side mixing is not supported on masternodes"); |
54 | | - |
55 | | - if (!privateSendClient.fEnablePrivateSend) { |
56 | | - if (fLiteMode) { |
57 | | - // mixing is disabled by default in lite mode |
58 | | - throw JSONRPCError(RPC_INTERNAL_ERROR, "Mixing is disabled in lite mode, use -enableprivatesend command line option to enable mixing again"); |
59 | | - } else if (!gArgs.GetBoolArg("-enableprivatesend", true)) { |
60 | | - // otherwise it's on by default, unless cmd line option says otherwise |
61 | | - throw JSONRPCError(RPC_INTERNAL_ERROR, "Mixing is disabled via -enableprivatesend=0 command line option, remove it to enable mixing again"); |
62 | | - } else { |
63 | | - // neither litemode nor enableprivatesend=false casee, |
64 | | - // most likely smth bad happened and we disabled it while running the wallet |
65 | | - throw JSONRPCError(RPC_INTERNAL_ERROR, "Mixing is disabled due to some internal error"); |
66 | | - } |
67 | | - } |
68 | | - |
69 | | - if (request.params[0].get_str() == "start") { |
70 | | - { |
71 | | - LOCK(pwallet->cs_wallet); |
72 | | - if (pwallet->IsLocked(true)) |
73 | | - throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please unlock wallet for mixing with walletpassphrase first."); |
74 | | - } |
75 | | - |
76 | | - privateSendClient.fPrivateSendRunning = true; |
77 | | - bool result = privateSendClient.DoAutomaticDenominating(*g_connman); |
78 | | - return "Mixing " + (result ? "started successfully" : ("start failed: " + privateSendClient.GetStatuses() + ", will retry")); |
79 | | - } |
80 | | - |
81 | | - if (request.params[0].get_str() == "stop") { |
82 | | - privateSendClient.fPrivateSendRunning = false; |
83 | | - return "Mixing was stopped"; |
84 | | - } |
85 | | - |
86 | | - if (request.params[0].get_str() == "reset") { |
87 | | - privateSendClient.ResetPool(); |
88 | | - return "Mixing was reset"; |
89 | | - } |
90 | | - |
91 | | - return "Unknown command, please see \"help privatesend\""; |
92 | | -} |
| 26 | +#include "wallet/wallet.h" |
93 | 27 | #endif // ENABLE_WALLET |
94 | 28 |
|
95 | | -UniValue getpoolinfo(const JSONRPCRequest& request) |
96 | | -{ |
97 | | - throw std::runtime_error( |
98 | | - "getpoolinfo\n" |
99 | | - "DEPRECATED. Please use getprivatesendinfo instead.\n" |
100 | | - ); |
101 | | -} |
102 | | - |
103 | | -UniValue getprivatesendinfo(const JSONRPCRequest& request) |
104 | | -{ |
105 | | - if (request.fHelp || request.params.size() != 0) { |
106 | | - throw std::runtime_error( |
107 | | - "getprivatesendinfo\n" |
108 | | - "Returns an object containing an information about PrivateSend settings and state.\n" |
109 | | - "\nResult (for regular nodes):\n" |
110 | | - "{\n" |
111 | | - " \"enabled\": true|false, (bool) Whether mixing functionality is enabled\n" |
112 | | - " \"running\": true|false, (bool) Whether mixing is currently running\n" |
113 | | - " \"multisession\": true|false, (bool) Whether PrivateSend Multisession option is enabled\n" |
114 | | - " \"max_sessions\": xxx, (numeric) How many parallel mixing sessions can there be at once\n" |
115 | | - " \"max_rounds\": xxx, (numeric) How many rounds to mix\n" |
116 | | - " \"max_amount\": xxx, (numeric) How many " + CURRENCY_UNIT + " to keep mixed\n" |
117 | | - " \"max_denoms\": xxx, (numeric) How many inputs of each denominated amount to create\n" |
118 | | - " \"queue_size\": xxx, (numeric) How many queues there are currently on the network\n" |
119 | | - " \"sessions\": (array of json objects)\n" |
120 | | - " [\n" |
121 | | - " {\n" |
122 | | - " \"protxhash\": \"...\", (string) The ProTxHash of the masternode\n" |
123 | | - " \"outpoint\": \"txid-index\", (string) The outpoint of the masternode\n" |
124 | | - " \"service\": \"host:port\", (string) The IP address and port of the masternode\n" |
125 | | - " \"denomination\": xxx, (numeric) The denomination of the mixing session in " + CURRENCY_UNIT + "\n" |
126 | | - " \"state\": \"...\", (string) Current state of the mixing session\n" |
127 | | - " \"entries_count\": xxx, (numeric) The number of entries in the mixing session\n" |
128 | | - " }\n" |
129 | | - " ,...\n" |
130 | | - " ],\n" |
131 | | - " \"keys_left\": xxx, (numeric) How many new keys are left since last automatic backup\n" |
132 | | - " \"warnings\": \"...\" (string) Warnings if any\n" |
133 | | - "}\n" |
134 | | - "\nResult (for masternodes):\n" |
135 | | - "{\n" |
136 | | - " \"queue_size\": xxx, (numeric) How many queues there are currently on the network\n" |
137 | | - " \"denomination\": xxx, (numeric) The denomination of the mixing session in " + CURRENCY_UNIT + "\n" |
138 | | - " \"state\": \"...\", (string) Current state of the mixing session\n" |
139 | | - " \"entries_count\": xxx, (numeric) The number of entries in the mixing session\n" |
140 | | - "}\n" |
141 | | - "\nExamples:\n" |
142 | | - + HelpExampleCli("getprivatesendinfo", "") |
143 | | - + HelpExampleRpc("getprivatesendinfo", "") |
144 | | - ); |
145 | | - } |
146 | | - |
147 | | - UniValue obj(UniValue::VOBJ); |
148 | | - |
149 | | - if (fMasternodeMode) { |
150 | | - privateSendServer.GetJsonInfo(obj); |
151 | | - return obj; |
152 | | - } |
153 | | - |
154 | | - |
155 | | -#ifdef ENABLE_WALLET |
156 | | - privateSendClient.GetJsonInfo(obj); |
157 | | - |
158 | | - CWallet* const pwallet = GetWalletForJSONRPCRequest(request); |
159 | | - if (!pwallet) { |
160 | | - return obj; |
161 | | - } |
162 | | - |
163 | | - obj.push_back(Pair("keys_left", pwallet->nKeysLeftSinceAutoBackup)); |
164 | | - obj.push_back(Pair("warnings", pwallet->nKeysLeftSinceAutoBackup < PRIVATESEND_KEYS_THRESHOLD_WARNING |
165 | | - ? "WARNING: keypool is almost depleted!" : "")); |
166 | | -#endif // ENABLE_WALLET |
| 29 | +#include <fstream> |
| 30 | +#include <iomanip> |
| 31 | +#include <univalue.h> |
167 | 32 |
|
168 | | - return obj; |
169 | | -} |
| 33 | +UniValue masternodelist(const JSONRPCRequest& request); |
170 | 34 |
|
171 | 35 | void masternode_list_help() |
172 | 36 | { |
@@ -668,11 +532,6 @@ static const CRPCCommand commands[] = |
668 | 532 | // --------------------- ------------------------ ----------------------- ------ ---------- |
669 | 533 | { "dash", "masternode", &masternode, true, {} }, |
670 | 534 | { "dash", "masternodelist", &masternodelist, true, {} }, |
671 | | - { "dash", "getpoolinfo", &getpoolinfo, true, {} }, |
672 | | - { "dash", "getprivatesendinfo", &getprivatesendinfo, true, {} }, |
673 | | -#ifdef ENABLE_WALLET |
674 | | - { "dash", "privatesend", &privatesend, false, {} }, |
675 | | -#endif // ENABLE_WALLET |
676 | 535 | }; |
677 | 536 |
|
678 | 537 | void RegisterMasternodeRPCCommands(CRPCTable &t) |
|
0 commit comments