Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

masternode.cpp
Go to the documentation of this file.
1 // Copyright (c) 2014-2019 The Dash Core developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
6 #include <base58.h>
7 #include <clientversion.h>
8 #include <init.h>
9 #include <netbase.h>
10 #include <validation.h>
11 #include <util.h>
12 #include <utilmoneystr.h>
13 #include <txmempool.h>
14 
15 #include <evo/specialtx.h>
16 #include <evo/deterministicmns.h>
17 
20 
21 #include <rpc/server.h>
22 
23 #include <wallet/coincontrol.h>
24 #include <wallet/rpcwallet.h>
25 #ifdef ENABLE_WALLET
26 #include <wallet/wallet.h>
27 #endif // ENABLE_WALLET
28 
29 #include <fstream>
30 #include <iomanip>
31 #include <univalue.h>
32 
33 UniValue masternodelist(const JSONRPCRequest& request);
34 
36 {
37  throw std::runtime_error(
38  "masternodelist ( \"mode\" \"filter\" )\n"
39  "Get a list of masternodes in different modes. This call is identical to 'masternode list' call.\n"
40  "\nArguments:\n"
41  "1. \"mode\" (string, optional/required to use filter, defaults = json) The mode to run list in\n"
42  "2. \"filter\" (string, optional) Filter results. Partial match by outpoint by default in all modes,\n"
43  " additional matches in some modes are also available\n"
44  "\nAvailable modes:\n"
45  " addr - Print ip address associated with a masternode (can be additionally filtered, partial match)\n"
46  " full - Print info in format 'status payee lastpaidtime lastpaidblock IP'\n"
47  " (can be additionally filtered, partial match)\n"
48  " info - Print info in format 'status payee IP'\n"
49  " (can be additionally filtered, partial match)\n"
50  " json - Print info in JSON format (can be additionally filtered, partial match)\n"
51  " lastpaidblock - Print the last block height a node was paid on the network\n"
52  " lastpaidtime - Print the last time a node was paid on the network\n"
53  " owneraddress - Print the masternode owner Dash address\n"
54  " payee - Print the masternode payout Dash address (can be additionally filtered,\n"
55  " partial match)\n"
56  " pubKeyOperator - Print the masternode operator public key\n"
57  " status - Print masternode status: ENABLED / POSE_BANNED\n"
58  " (can be additionally filtered, partial match)\n"
59  " votingaddress - Print the masternode voting Dash address\n"
60  );
61 }
62 
64 {
65  if (request.fHelp)
67  JSONRPCRequest newRequest = request;
68  newRequest.params.setArray();
69  // forward params but skip "list"
70  for (unsigned int i = 1; i < request.params.size(); i++) {
71  newRequest.params.push_back(request.params[i]);
72  }
73  return masternodelist(newRequest);
74 }
75 
77 {
78  throw std::runtime_error(
79  "masternode connect \"address\"\n"
80  "Connect to given masternode\n"
81  "\nArguments:\n"
82  "1. \"address\" (string, required) The address of the masternode to connect\n"
83  );
84 }
85 
87 {
88  if (request.fHelp || request.params.size() < 2)
90 
91  std::string strAddress = request.params[1].get_str();
92 
93  CService addr;
94  if (!Lookup(strAddress.c_str(), addr, 0, false))
95  throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf("Incorrect masternode address %s", strAddress));
96 
97  // TODO: Pass CConnman instance somehow and don't use global variable.
98  g_connman->OpenMasternodeConnection(CAddress(addr, NODE_NETWORK));
99  if (!g_connman->IsConnected(CAddress(addr, NODE_NETWORK), CConnman::AllNodes))
100  throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf("Couldn't connect to masternode %s", strAddress));
101 
102  return "successfully connected";
103 }
104 
106 {
107  throw std::runtime_error(
108  "masternode count (\"mode\")\n"
109  " Get information about number of masternodes. Mode\n"
110  " usage is depricated, call without mode params returns\n"
111  " all values in JSON format.\n"
112  "\nArguments:\n"
113  "1. \"mode\" (string, optional, DEPRICATED) Option to get number of masternodes in different states\n"
114  "\nAvailable modes:\n"
115  " total - total number of masternodes"
116  " ps - number of PrivateSend compatible masternodes"
117  " enabled - number of enabled masternodes"
118  " qualify - number of qualified masternodes"
119  " all - all above in one string"
120  );
121 }
122 
124 {
125  if (request.fHelp || request.params.size() > 2)
127 
128  auto mnList = deterministicMNManager->GetListAtChainTip();
129  int total = mnList.GetAllMNsCount();
130  int enabled = mnList.GetValidMNsCount();
131 
132  if (request.params.size() == 1) {
134 
135  obj.push_back(Pair("total", total));
136  obj.push_back(Pair("enabled", enabled));
137 
138  return obj;
139  }
140 
141  std::string strMode = request.params[1].get_str();
142 
143  if (strMode == "total")
144  return total;
145 
146  if (strMode == "enabled")
147  return enabled;
148 
149  if (strMode == "all")
150  return strprintf("Total: %d (Enabled: %d)",
151  total, enabled);
152 
153  throw JSONRPCError(RPC_INVALID_PARAMETER, "Unknown mode value");
154 }
155 
157 {
158  auto mnList = deterministicMNManager->GetListAtChainTip();
159  auto payees = mnList.GetProjectedMNPayees(heightShift);
160  if (payees.empty())
161  return "unknown";
162  auto payee = payees.back();
163  CScript payeeScript = payee->pdmnState->scriptPayout;
164 
165  CTxDestination payeeDest;
166  ExtractDestination(payeeScript, payeeDest);
167 
169 
170  obj.push_back(Pair("height", mnList.GetHeight() + heightShift));
171  obj.push_back(Pair("IP:port", payee->pdmnState->addr.ToString()));
172  obj.push_back(Pair("proTxHash", payee->proTxHash.ToString()));
173  obj.push_back(Pair("outpoint", payee->collateralOutpoint.ToStringShort()));
174  obj.push_back(Pair("payee", IsValidDestination(payeeDest) ? EncodeDestination(payeeDest) : "UNKNOWN"));
175  return obj;
176 }
177 
179 {
180  throw std::runtime_error(
181  "masternode winner\n"
182  "Print info on next masternode winner to vote for\n"
183  );
184 }
185 
187 {
188  if (request.fHelp)
190 
191  return GetNextMasternodeForPayment(10);
192 }
193 
195 {
196  throw std::runtime_error(
197  "masternode current\n"
198  "Print info on current masternode winner to be paid the next block (calculated locally)\n"
199  );
200 }
201 
203 {
204  if (request.fHelp)
206 
207  return GetNextMasternodeForPayment(1);
208 }
209 
210 #ifdef ENABLE_WALLET
211 void masternode_outputs_help()
212 {
213  throw std::runtime_error(
214  "masternode outputs\n"
215  "Print masternode compatible outputs\n"
216  );
217 }
218 
219 UniValue masternode_outputs(const JSONRPCRequest& request)
220 {
221  CWallet* const pwallet = GetWalletForJSONRPCRequest(request);
222  if (request.fHelp)
223  masternode_outputs_help();
224 
225  if (!EnsureWalletIsAvailable(pwallet, request.fHelp))
226  return NullUniValue;
227 
228  // Find possible candidates
229  std::vector<COutput> vPossibleCoins;
230  CCoinControl coin_control;
232  pwallet->AvailableCoins(vPossibleCoins, true, &coin_control);
233 
235  for (const auto& out : vPossibleCoins) {
236  obj.push_back(Pair(out.tx->GetHash().ToString(), strprintf("%d", out.i)));
237  }
238 
239  return obj;
240 }
241 
242 #endif // ENABLE_WALLET
243 
245 {
246  throw std::runtime_error(
247  "masternode status\n"
248  "Print masternode status information\n"
249  );
250 }
251 
253 {
254  if (request.fHelp)
256 
257  if (!fMasternodeMode)
258  throw JSONRPCError(RPC_INTERNAL_ERROR, "This is not a masternode");
259 
260  UniValue mnObj(UniValue::VOBJ);
261 
262  // keep compatibility with legacy status for now (might get deprecated/removed later)
264  mnObj.push_back(Pair("service", activeMasternodeInfo.service.ToString()));
265 
266  auto dmn = deterministicMNManager->GetListAtChainTip().GetMN(activeMasternodeInfo.proTxHash);
267  if (dmn) {
268  mnObj.push_back(Pair("proTxHash", dmn->proTxHash.ToString()));
269  mnObj.push_back(Pair("collateralHash", dmn->collateralOutpoint.hash.ToString()));
270  mnObj.push_back(Pair("collateralIndex", (int)dmn->collateralOutpoint.n));
271  UniValue stateObj;
272  dmn->pdmnState->ToJson(stateObj);
273  mnObj.push_back(Pair("dmnState", stateObj));
274  }
276  mnObj.push_back(Pair("status", activeMasternodeManager->GetStatus()));
277 
278  return mnObj;
279 }
280 
282 {
283  throw std::runtime_error(
284  "masternode winners ( count \"filter\" )\n"
285  "Print list of masternode winners\n"
286  "\nArguments:\n"
287  "1. count (numeric, optional) number of last winners to return\n"
288  "2. filter (string, optional) filter for returned winners\n"
289  );
290 }
291 
293 {
294  if (request.fHelp || request.params.size() > 3)
296 
297  int nHeight;
298  {
299  LOCK(cs_main);
300  CBlockIndex* pindex = chainActive.Tip();
301  if (!pindex) return NullUniValue;
302 
303  nHeight = pindex->nHeight;
304  }
305 
306  int nLast = 10;
307  std::string strFilter = "";
308 
309  if (!request.params[1].isNull()) {
310  nLast = atoi(request.params[1].get_str());
311  }
312 
313  if (!request.params[2].isNull()) {
314  strFilter = request.params[2].get_str();
315  }
316 
318  auto mapPayments = GetRequiredPaymentsStrings(nHeight - nLast, nHeight + 20);
319  for (const auto &p : mapPayments) {
320  obj.push_back(Pair(strprintf("%d", p.first), p.second));
321  }
322 
323  return obj;
324 }
325 
326 [[ noreturn ]] void masternode_help()
327 {
328  throw std::runtime_error(
329  "masternode \"command\" ...\n"
330  "Set of commands to execute masternode related actions\n"
331  "\nArguments:\n"
332  "1. \"command\" (string or set of strings, required) The command to execute\n"
333  "\nAvailable commands:\n"
334  " count - Get information about number of masternodes (DEPRECATED options: 'total', 'ps', 'enabled', 'qualify', 'all')\n"
335  " current - Print info on current masternode winner to be paid the next block (calculated locally)\n"
336 #ifdef ENABLE_WALLET
337  " outputs - Print masternode compatible outputs\n"
338 #endif // ENABLE_WALLET
339  " status - Print masternode status information\n"
340  " list - Print list of all known masternodes (see masternodelist for more info)\n"
341  " winner - Print info on next masternode winner to vote for\n"
342  " winners - Print list of masternode winners\n"
343  );
344 }
345 
347 {
348  std::string strCommand;
349  if (!request.params[0].isNull()) {
350  strCommand = request.params[0].get_str();
351  }
352 
353  if (request.fHelp && strCommand.empty()) {
354  masternode_help();
355  }
356 
357  if (strCommand == "list") {
358  return masternode_list(request);
359  } else if (strCommand == "connect") {
360  return masternode_connect(request);
361  } else if (strCommand == "count") {
362  return masternode_count(request);
363  } else if (strCommand == "current") {
364  return masternode_current(request);
365  } else if (strCommand == "winner") {
366  return masternode_winner(request);
367 #ifdef ENABLE_WALLET
368  } else if (strCommand == "outputs") {
369  return masternode_outputs(request);
370 #endif // ENABLE_WALLET
371  } else if (strCommand == "status") {
372  return masternode_status(request);
373  } else if (strCommand == "winners") {
374  return masternode_winners(request);
375  } else {
376  masternode_help();
377  }
378 }
379 
381 {
382  std::string strMode = "json";
383  std::string strFilter = "";
384 
385  if (!request.params[0].isNull()) strMode = request.params[0].get_str();
386  if (!request.params[1].isNull()) strFilter = request.params[1].get_str();
387 
388  std::transform(strMode.begin(), strMode.end(), strMode.begin(), ::tolower);
389 
390  if (request.fHelp || (
391  strMode != "addr" && strMode != "full" && strMode != "info" && strMode != "json" &&
392  strMode != "owneraddress" && strMode != "votingaddress" &&
393  strMode != "lastpaidtime" && strMode != "lastpaidblock" &&
394  strMode != "payee" && strMode != "pubkeyoperator" &&
395  strMode != "status"))
396  {
398  }
399 
401 
402  auto mnList = deterministicMNManager->GetListAtChainTip();
403  auto dmnToStatus = [&](const CDeterministicMNCPtr& dmn) {
404  if (mnList.IsMNValid(dmn)) {
405  return "ENABLED";
406  }
407  if (mnList.IsMNPoSeBanned(dmn)) {
408  return "POSE_BANNED";
409  }
410  return "UNKNOWN";
411  };
412  auto dmnToLastPaidTime = [&](const CDeterministicMNCPtr& dmn) {
413  if (dmn->pdmnState->nLastPaidHeight == 0) {
414  return (int)0;
415  }
416 
417  LOCK(cs_main);
418  const CBlockIndex* pindex = chainActive[dmn->pdmnState->nLastPaidHeight];
419  return (int)pindex->nTime;
420  };
421 
422  mnList.ForEachMN(false, [&](const CDeterministicMNCPtr& dmn) {
423  std::string strOutpoint = dmn->collateralOutpoint.ToStringShort();
424  Coin coin;
425  std::string collateralAddressStr = "UNKNOWN";
426  if (GetUTXOCoin(dmn->collateralOutpoint, coin)) {
427  CTxDestination collateralDest;
428  if (ExtractDestination(coin.out.scriptPubKey, collateralDest)) {
429  collateralAddressStr = EncodeDestination(collateralDest);
430  }
431  }
432 
433  CScript payeeScript = dmn->pdmnState->scriptPayout;
434  CTxDestination payeeDest;
435  std::string payeeStr = "UNKNOWN";
436  if (ExtractDestination(payeeScript, payeeDest)) {
437  payeeStr = EncodeDestination(payeeDest);
438  }
439 
440  if (strMode == "addr") {
441  std::string strAddress = dmn->pdmnState->addr.ToString(false);
442  if (strFilter !="" && strAddress.find(strFilter) == std::string::npos &&
443  strOutpoint.find(strFilter) == std::string::npos) return;
444  obj.push_back(Pair(strOutpoint, strAddress));
445  } else if (strMode == "full") {
446  std::ostringstream streamFull;
447  streamFull << std::setw(18) <<
448  dmnToStatus(dmn) << " " <<
449  payeeStr << " " << std::setw(10) <<
450  dmnToLastPaidTime(dmn) << " " << std::setw(6) <<
451  dmn->pdmnState->nLastPaidHeight << " " <<
452  dmn->pdmnState->addr.ToString();
453  std::string strFull = streamFull.str();
454  if (strFilter !="" && strFull.find(strFilter) == std::string::npos &&
455  strOutpoint.find(strFilter) == std::string::npos) return;
456  obj.push_back(Pair(strOutpoint, strFull));
457  } else if (strMode == "info") {
458  std::ostringstream streamInfo;
459  streamInfo << std::setw(18) <<
460  dmnToStatus(dmn) << " " <<
461  payeeStr << " " <<
462  dmn->pdmnState->addr.ToString();
463  std::string strInfo = streamInfo.str();
464  if (strFilter !="" && strInfo.find(strFilter) == std::string::npos &&
465  strOutpoint.find(strFilter) == std::string::npos) return;
466  obj.push_back(Pair(strOutpoint, strInfo));
467  } else if (strMode == "json") {
468  std::ostringstream streamInfo;
469  streamInfo << dmn->proTxHash.ToString() << " " <<
470  dmn->pdmnState->addr.ToString() << " " <<
471  payeeStr << " " <<
472  dmnToStatus(dmn) << " " <<
473  dmnToLastPaidTime(dmn) << " " <<
474  dmn->pdmnState->nLastPaidHeight << " " <<
475  EncodeDestination(dmn->pdmnState->keyIDOwner) << " " <<
476  EncodeDestination(dmn->pdmnState->keyIDVoting) << " " <<
477  collateralAddressStr << " " <<
478  dmn->pdmnState->pubKeyOperator.Get().ToString();
479  std::string strInfo = streamInfo.str();
480  if (strFilter !="" && strInfo.find(strFilter) == std::string::npos &&
481  strOutpoint.find(strFilter) == std::string::npos) return;
482  UniValue objMN(UniValue::VOBJ);
483  objMN.push_back(Pair("proTxHash", dmn->proTxHash.ToString()));
484  objMN.push_back(Pair("address", dmn->pdmnState->addr.ToString()));
485  objMN.push_back(Pair("payee", payeeStr));
486  objMN.push_back(Pair("status", dmnToStatus(dmn)));
487  objMN.push_back(Pair("lastpaidtime", dmnToLastPaidTime(dmn)));
488  objMN.push_back(Pair("lastpaidblock", dmn->pdmnState->nLastPaidHeight));
489  objMN.push_back(Pair("owneraddress", EncodeDestination(dmn->pdmnState->keyIDOwner)));
490  objMN.push_back(Pair("votingaddress", EncodeDestination(dmn->pdmnState->keyIDVoting)));
491  objMN.push_back(Pair("collateraladdress", collateralAddressStr));
492  objMN.push_back(Pair("pubkeyoperator", dmn->pdmnState->pubKeyOperator.Get().ToString()));
493  obj.push_back(Pair(strOutpoint, objMN));
494  } else if (strMode == "lastpaidblock") {
495  if (strFilter !="" && strOutpoint.find(strFilter) == std::string::npos) return;
496  obj.push_back(Pair(strOutpoint, dmn->pdmnState->nLastPaidHeight));
497  } else if (strMode == "lastpaidtime") {
498  if (strFilter !="" && strOutpoint.find(strFilter) == std::string::npos) return;
499  obj.push_back(Pair(strOutpoint, dmnToLastPaidTime(dmn)));
500  } else if (strMode == "payee") {
501  if (strFilter !="" && payeeStr.find(strFilter) == std::string::npos &&
502  strOutpoint.find(strFilter) == std::string::npos) return;
503  obj.push_back(Pair(strOutpoint, payeeStr));
504  } else if (strMode == "owneraddress") {
505  if (strFilter !="" && strOutpoint.find(strFilter) == std::string::npos) return;
506  obj.push_back(Pair(strOutpoint, EncodeDestination(dmn->pdmnState->keyIDOwner)));
507  } else if (strMode == "pubkeyoperator") {
508  if (strFilter !="" && strOutpoint.find(strFilter) == std::string::npos) return;
509  obj.push_back(Pair(strOutpoint, dmn->pdmnState->pubKeyOperator.Get().ToString()));
510  } else if (strMode == "status") {
511  std::string strStatus = dmnToStatus(dmn);
512  if (strFilter !="" && strStatus.find(strFilter) == std::string::npos &&
513  strOutpoint.find(strFilter) == std::string::npos) return;
514  obj.push_back(Pair(strOutpoint, strStatus));
515  } else if (strMode == "votingaddress") {
516  if (strFilter !="" && strOutpoint.find(strFilter) == std::string::npos) return;
517  obj.push_back(Pair(strOutpoint, EncodeDestination(dmn->pdmnState->keyIDVoting)));
518  }
519  });
520 
521  return obj;
522 }
523 
524 static const CRPCCommand commands[] =
525 { // category name actor (function) argNames
526  // --------------------- ------------------------ ----------------------- ----------
527  { "dash", "masternode", &masternode, {} },
528  { "dash", "masternodelist", &masternodelist, {} },
529 };
530 
532 {
533  for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
534  t.appendCommand(commands[vcidx].name, &commands[vcidx]);
535 }
void masternode_winners_help()
Definition: masternode.cpp:281
void RegisterMasternodeRPCCommands(CRPCTable &t)
Register masternode RPC commands.
Definition: masternode.cpp:531
UniValue masternode_status(const JSONRPCRequest &request)
Definition: masternode.cpp:252
static constexpr const CAllNodes AllNodes
Definition: net.h:225
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:80
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
Definition: standard.cpp:158
std::string ToString(bool fUseGetnameinfo=true) const
Definition: netaddress.cpp:581
Dash RPC command dispatcher.
Definition: server.h:140
UniValue masternode_current(const JSONRPCRequest &request)
Definition: masternode.cpp:202
CScript scriptPubKey
Definition: transaction.h:148
A UTXO entry.
Definition: coins.h:29
UniValue masternode_connect(const JSONRPCRequest &request)
Definition: masternode.cpp:86
#define strprintf
Definition: tinyformat.h:1066
bool EnsureWalletIsAvailable(CWallet *const pwallet, bool avoidException)
Definition: rpcwallet.cpp:66
CCriticalSection cs_main
Definition: validation.cpp:213
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
Definition: standard.cpp:281
CTxOut out
unspent transaction output
Definition: coins.h:33
const std::string & get_str() const
UniValue masternode_winner(const JSONRPCRequest &request)
Definition: masternode.cpp:186
uint32_t nTime
Definition: chain.h:212
std::shared_ptr< const CDeterministicMN > CDeterministicMNCPtr
void masternode_current_help()
Definition: masternode.cpp:194
std::unique_ptr< CDeterministicMNManager > deterministicMNManager
bool appendCommand(const std::string &name, const CRPCCommand *pcmd)
Appends a CRPCCommand to the dispatch table.
Definition: server.cpp:353
UniValue GetNextMasternodeForPayment(int heightShift)
Definition: masternode.cpp:156
Coin Control Features.
Definition: coincontrol.h:28
Invalid, missing or duplicate parameter.
Definition: protocol.h:53
void masternode_count_help()
Definition: masternode.cpp:105
UniValue masternode_count(const JSONRPCRequest &request)
Definition: masternode.cpp:123
bool fMasternodeMode
Definition: util.cpp:93
bool GetUTXOCoin(const COutPoint &outpoint, Coin &coin)
Definition: validation.cpp:439
std::string name
Definition: server.h:132
bool push_back(const UniValue &val)
Definition: univalue.cpp:110
void masternode_connect_help()
Definition: masternode.cpp:76
CActiveMasternodeInfo activeMasternodeInfo
UniValue params
Definition: server.h:42
#define LOCK(cs)
Definition: sync.h:178
A combination of a network address (CNetAddr) and a (TCP) port.
Definition: netaddress.h:143
void masternode_status_help()
Definition: masternode.cpp:244
A CService with information about it as peer.
Definition: protocol.h:358
void masternode_winner_help()
Definition: masternode.cpp:178
CoinType nCoinType
Controls which types of coins are allowed to be used (default: ALL_COINS)
Definition: coincontrol.h:49
static std::pair< std::string, UniValue > Pair(const char *cKey, const char *cVal)
Definition: univalue.h:185
static const CRPCCommand commands[]
Definition: masternode.cpp:524
UniValue masternode_winners(const JSONRPCRequest &request)
Definition: masternode.cpp:292
bool isNull() const
Definition: univalue.h:78
void AvailableCoins(std::vector< COutput > &vCoins, bool fOnlySafe=true, const CCoinControl *coinControl=nullptr, const CAmount &nMinimumAmount=1, const CAmount &nMaximumAmount=MAX_MONEY, const CAmount &nMinimumSumAmount=MAX_MONEY, const uint64_t nMaximumCount=0, const int nMinDepth=0, const int nMaxDepth=9999999) const
populate vCoins with vector of available COutputs.
Definition: wallet.cpp:2775
bool fHelp
Definition: server.h:43
UniValue masternodelist(const JSONRPCRequest &request)
Definition: masternode.cpp:380
#define ARRAYLEN(array)
bool setArray()
Definition: univalue.cpp:96
std::string EncodeDestination(const CTxDestination &dest)
Definition: base58.cpp:329
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:170
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:389
void masternode_list_help()
Definition: masternode.cpp:35
std::map< int, std::string > GetRequiredPaymentsStrings(int nStartHeight, int nEndHeight)
bool Lookup(const char *pszName, std::vector< CService > &vAddr, int portDefault, bool fAllowLookup, unsigned int nMaxSolutions)
Definition: netbase.cpp:140
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or nullptr if none.
Definition: chain.h:453
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:715
std::unique_ptr< CConnman > g_connman
Definition: init.cpp:97
const UniValue NullUniValue
Definition: univalue.cpp:15
CWallet * GetWalletForJSONRPCRequest(const JSONRPCRequest &request)
Figures out what wallet, if any, to use for a JSONRPCRequest.
Definition: rpcwallet.cpp:45
UniValue masternode(const JSONRPCRequest &request)
Definition: masternode.cpp:346
std::string GetStateString() const
std::string GetStatus() const
UniValue JSONRPCError(int code, const std::string &message)
Definition: protocol.cpp:54
size_t size() const
Definition: univalue.h:69
int nHeight
height of the entry in the chain. The genesis block has height 0
Definition: chain.h:183
CChain & chainActive
The currently-connected chain of blocks (protected by cs_main).
Definition: validation.cpp:217
UniValue masternode_list(const JSONRPCRequest &request)
Definition: masternode.cpp:63
void masternode_help()
Definition: masternode.cpp:326
int atoi(const std::string &str)
CActiveMasternodeManager * activeMasternodeManager
std::string ToStringShort() const
Definition: transaction.cpp:17
Released under the MIT license