mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge #7766: rpc: Register calls where they are defined
fb8a8cf
rpc: Register calls where they are defined (Wladimir J. van der Laan)
This commit is contained in:
parent
18da34e295
commit
644240157a
@ -149,6 +149,7 @@ BITCOIN_CORE_H = \
|
||||
rpc/client.h \
|
||||
rpc/protocol.h \
|
||||
rpc/server.h \
|
||||
rpc/register.h \
|
||||
scheduler.h \
|
||||
script/sigcache.h \
|
||||
script/sign.h \
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "net_processing.h"
|
||||
#include "policy/policy.h"
|
||||
#include "rpc/server.h"
|
||||
#include "rpc/register.h"
|
||||
#include "script/standard.h"
|
||||
#include "script/sigcache.h"
|
||||
#include "scheduler.h"
|
||||
@ -1083,10 +1084,11 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
fPruneMode = true;
|
||||
}
|
||||
|
||||
RegisterAllCoreRPCCommands(tableRPC);
|
||||
#ifdef ENABLE_WALLET
|
||||
bool fDisableWallet = GetBoolArg("-disablewallet", false);
|
||||
if (!fDisableWallet)
|
||||
walletRegisterRPCCommands();
|
||||
RegisterWalletRPCCommands(tableRPC);
|
||||
#endif
|
||||
|
||||
nConnectTimeout = GetArg("-timeout", DEFAULT_CONNECT_TIMEOUT);
|
||||
|
@ -276,6 +276,9 @@ static bool rest_block_notxdetails(HTTPRequest* req, const std::string& strURIPa
|
||||
return rest_block(req, strURIPart, false);
|
||||
}
|
||||
|
||||
// A bit of a hack - dependency on a function defined in rpc/blockchain.cpp
|
||||
UniValue getblockchaininfo(const UniValue& params, bool fHelp);
|
||||
|
||||
static bool rest_chaininfo(HTTPRequest* req, const std::string& strURIPart)
|
||||
{
|
||||
if (!CheckWarmup(req))
|
||||
|
@ -1127,3 +1127,33 @@ UniValue reconsiderblock(const UniValue& params, bool fHelp)
|
||||
|
||||
return NullUniValue;
|
||||
}
|
||||
|
||||
static const CRPCCommand commands[] =
|
||||
{ // category name actor (function) okSafeMode
|
||||
// --------------------- ------------------------ ----------------------- ----------
|
||||
{ "blockchain", "getblockchaininfo", &getblockchaininfo, true },
|
||||
{ "blockchain", "getbestblockhash", &getbestblockhash, true },
|
||||
{ "blockchain", "getblockcount", &getblockcount, true },
|
||||
{ "blockchain", "getblock", &getblock, true },
|
||||
{ "blockchain", "getblockhashes", &getblockhashes, true },
|
||||
{ "blockchain", "getblockhash", &getblockhash, true },
|
||||
{ "blockchain", "getblockheader", &getblockheader, true },
|
||||
{ "blockchain", "getblockheaders", &getblockheaders, true },
|
||||
{ "blockchain", "getchaintips", &getchaintips, true },
|
||||
{ "blockchain", "getdifficulty", &getdifficulty, true },
|
||||
{ "blockchain", "getmempoolinfo", &getmempoolinfo, true },
|
||||
{ "blockchain", "getrawmempool", &getrawmempool, true },
|
||||
{ "blockchain", "gettxout", &gettxout, true },
|
||||
{ "blockchain", "gettxoutsetinfo", &gettxoutsetinfo, true },
|
||||
{ "blockchain", "verifychain", &verifychain, true },
|
||||
|
||||
/* Not shown in help */
|
||||
{ "hidden", "invalidateblock", &invalidateblock, true },
|
||||
{ "hidden", "reconsiderblock", &reconsiderblock, true },
|
||||
};
|
||||
|
||||
void RegisterBlockchainRPCCommands(CRPCTable &tableRPC)
|
||||
{
|
||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
||||
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
||||
}
|
||||
|
@ -992,3 +992,18 @@ UniValue getsuperblockbudget(const UniValue& params, bool fHelp)
|
||||
return strBudget;
|
||||
}
|
||||
|
||||
static const CRPCCommand commands[] =
|
||||
{ // category name actor (function) okSafeMode
|
||||
/* Dash features */
|
||||
{ "dash", "getgovernanceinfo", &getgovernanceinfo, true },
|
||||
{ "dash", "getsuperblockbudget", &getsuperblockbudget, true },
|
||||
{ "dash", "gobject", &gobject, true },
|
||||
{ "dash", "voteraw", &voteraw, true },
|
||||
|
||||
};
|
||||
|
||||
void RegisterGovernanceRPCCommands(CRPCTable &tableRPC)
|
||||
{
|
||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
||||
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
||||
}
|
@ -26,6 +26,8 @@
|
||||
#ifdef ENABLE_WALLET
|
||||
void EnsureWalletIsUnlocked();
|
||||
|
||||
UniValue masternodelist(const UniValue& params, bool fHelp);
|
||||
|
||||
UniValue privatesend(const UniValue& params, bool fHelp)
|
||||
{
|
||||
if (fHelp || params.size() != 1)
|
||||
@ -849,3 +851,20 @@ UniValue sentinelping(const UniValue& params, bool fHelp)
|
||||
activeMasternode.UpdateSentinelPing(StringVersionToInt(params[0].get_str()));
|
||||
return true;
|
||||
}
|
||||
|
||||
static const CRPCCommand commands[] =
|
||||
{ // category name actor (function) okSafeMode
|
||||
/* Dash features */
|
||||
{ "dash", "masternode", &masternode, true },
|
||||
{ "dash", "masternodelist", &masternodelist, true },
|
||||
{ "dash", "masternodebroadcast", &masternodebroadcast, true },
|
||||
{ "dash", "getpoolinfo", &getpoolinfo, true },
|
||||
{ "dash", "sentinelping", &sentinelping, true },
|
||||
{ "dash", "privatesend", &privatesend, false },
|
||||
};
|
||||
|
||||
void RegisterMasternodeRPCCommands(CRPCTable &tableRPC)
|
||||
{
|
||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
||||
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
||||
}
|
@ -932,3 +932,27 @@ UniValue estimatesmartpriority(const UniValue& params, bool fHelp)
|
||||
result.push_back(Pair("blocks", answerFound));
|
||||
return result;
|
||||
}
|
||||
|
||||
static const CRPCCommand commands[] =
|
||||
{ // category name actor (function) okSafeMode
|
||||
// --------------------- ------------------------ ----------------------- ----------
|
||||
{ "mining", "getnetworkhashps", &getnetworkhashps, true },
|
||||
{ "mining", "getmininginfo", &getmininginfo, true },
|
||||
{ "mining", "prioritisetransaction", &prioritisetransaction, true },
|
||||
{ "mining", "getblocktemplate", &getblocktemplate, true },
|
||||
{ "mining", "submitblock", &submitblock, true },
|
||||
|
||||
{ "generating", "generate", &generate, true },
|
||||
{ "generating", "generatetoaddress", &generatetoaddress, true },
|
||||
|
||||
{ "util", "estimatefee", &estimatefee, true },
|
||||
{ "util", "estimatepriority", &estimatepriority, true },
|
||||
{ "util", "estimatesmartfee", &estimatesmartfee, true },
|
||||
{ "util", "estimatesmartpriority", &estimatesmartpriority, true },
|
||||
};
|
||||
|
||||
void RegisterMiningRPCCommands(CRPCTable &tableRPC)
|
||||
{
|
||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
||||
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
||||
}
|
||||
|
@ -1001,3 +1001,34 @@ UniValue getspentinfo(const UniValue& params, bool fHelp)
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static const CRPCCommand commands[] =
|
||||
{ // category name actor (function) okSafeMode
|
||||
// --------------------- ------------------------ ----------------------- ----------
|
||||
{ "control", "debug", &debug, true },
|
||||
{ "control", "getinfo", &getinfo, true }, /* uses wallet if enabled */
|
||||
{ "util", "validateaddress", &validateaddress, true }, /* uses wallet if enabled */
|
||||
{ "util", "createmultisig", &createmultisig, true },
|
||||
{ "util", "verifymessage", &verifymessage, true },
|
||||
{ "blockchain", "getspentinfo", &getspentinfo, false },
|
||||
|
||||
/* Address index */
|
||||
{ "addressindex", "getaddressmempool", &getaddressmempool, true },
|
||||
{ "addressindex", "getaddressutxos", &getaddressutxos, false },
|
||||
{ "addressindex", "getaddressdeltas", &getaddressdeltas, false },
|
||||
{ "addressindex", "getaddresstxids", &getaddresstxids, false },
|
||||
{ "addressindex", "getaddressbalance", &getaddressbalance, false },
|
||||
|
||||
/* Dash features */
|
||||
{ "dash", "mnsync", &mnsync, true },
|
||||
{ "dash", "spork", &spork, true },
|
||||
|
||||
/* Not shown in help */
|
||||
{ "hidden", "setmocktime", &setmocktime, true },
|
||||
};
|
||||
|
||||
void RegisterMiscRPCCommands(CRPCTable &tableRPC)
|
||||
{
|
||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
||||
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
||||
}
|
||||
|
@ -594,3 +594,26 @@ UniValue setnetworkactive(const UniValue& params, bool fHelp)
|
||||
|
||||
return g_connman->GetNetworkActive();
|
||||
}
|
||||
|
||||
static const CRPCCommand commands[] =
|
||||
{ // category name actor (function) okSafeMode
|
||||
// --------------------- ------------------------ ----------------------- ----------
|
||||
{ "network", "getconnectioncount", &getconnectioncount, true },
|
||||
{ "network", "ping", &ping, true },
|
||||
{ "network", "getpeerinfo", &getpeerinfo, true },
|
||||
{ "network", "addnode", &addnode, true },
|
||||
{ "network", "disconnectnode", &disconnectnode, true },
|
||||
{ "network", "getaddednodeinfo", &getaddednodeinfo, true },
|
||||
{ "network", "getnettotals", &getnettotals, true },
|
||||
{ "network", "getnetworkinfo", &getnetworkinfo, true },
|
||||
{ "network", "setban", &setban, true },
|
||||
{ "network", "listbanned", &listbanned, true },
|
||||
{ "network", "clearbanned", &clearbanned, true },
|
||||
{ "network", "setnetworkactive", &setnetworkactive, true, },
|
||||
};
|
||||
|
||||
void RegisterNetRPCCommands(CRPCTable &tableRPC)
|
||||
{
|
||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
||||
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
||||
}
|
||||
|
@ -904,3 +904,23 @@ UniValue sendrawtransaction(const UniValue& params, bool fHelp)
|
||||
|
||||
return hashTx.GetHex();
|
||||
}
|
||||
|
||||
static const CRPCCommand commands[] =
|
||||
{ // category name actor (function) okSafeMode
|
||||
// --------------------- ------------------------ ----------------------- ----------
|
||||
{ "rawtransactions", "getrawtransaction", &getrawtransaction, true },
|
||||
{ "rawtransactions", "createrawtransaction", &createrawtransaction, true },
|
||||
{ "rawtransactions", "decoderawtransaction", &decoderawtransaction, true },
|
||||
{ "rawtransactions", "decodescript", &decodescript, true },
|
||||
{ "rawtransactions", "sendrawtransaction", &sendrawtransaction, false },
|
||||
{ "rawtransactions", "signrawtransaction", &signrawtransaction, false }, /* uses wallet if enabled */
|
||||
|
||||
{ "blockchain", "gettxoutproof", &gettxoutproof, true },
|
||||
{ "blockchain", "verifytxoutproof", &verifytxoutproof, true },
|
||||
};
|
||||
|
||||
void RegisterRawTransactionRPCCommands(CRPCTable &tableRPC)
|
||||
{
|
||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
||||
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
||||
}
|
||||
|
38
src/rpc/register.h
Normal file
38
src/rpc/register.h
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2009-2016 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_RPCREGISTER_H
|
||||
#define BITCOIN_RPCREGISTER_H
|
||||
|
||||
/** These are in one header file to avoid creating tons of single-function
|
||||
* headers for everything under src/rpc/ */
|
||||
class CRPCTable;
|
||||
|
||||
/** Register block chain RPC commands */
|
||||
void RegisterBlockchainRPCCommands(CRPCTable &tableRPC);
|
||||
/** Register P2P networking RPC commands */
|
||||
void RegisterNetRPCCommands(CRPCTable &tableRPC);
|
||||
/** Register miscellaneous RPC commands */
|
||||
void RegisterMiscRPCCommands(CRPCTable &tableRPC);
|
||||
/** Register mining RPC commands */
|
||||
void RegisterMiningRPCCommands(CRPCTable &tableRPC);
|
||||
/** Register raw transaction RPC commands */
|
||||
void RegisterRawTransactionRPCCommands(CRPCTable &tableRPC);
|
||||
/** Register masternode RPC commands */
|
||||
void RegisterMasternodeRPCCommands(CRPCTable &tableRPC);
|
||||
/** Register governance RPC commands */
|
||||
void RegisterGovernanceRPCCommands(CRPCTable &tableRPC);
|
||||
|
||||
static inline void RegisterAllCoreRPCCommands(CRPCTable &tableRPC)
|
||||
{
|
||||
RegisterBlockchainRPCCommands(tableRPC);
|
||||
RegisterNetRPCCommands(tableRPC);
|
||||
RegisterMiscRPCCommands(tableRPC);
|
||||
RegisterMiningRPCCommands(tableRPC);
|
||||
RegisterRawTransactionRPCCommands(tableRPC);
|
||||
RegisterMasternodeRPCCommands(tableRPC);
|
||||
RegisterGovernanceRPCCommands(tableRPC);
|
||||
}
|
||||
|
||||
#endif
|
@ -257,96 +257,8 @@ static const CRPCCommand vRPCCommands[] =
|
||||
{ // category name actor (function) okSafeMode
|
||||
// --------------------- ------------------------ ----------------------- ----------
|
||||
/* Overall control/query calls */
|
||||
{ "control", "getinfo", &getinfo, true }, /* uses wallet if enabled */
|
||||
{ "control", "debug", &debug, true },
|
||||
{ "control", "help", &help, true },
|
||||
{ "control", "stop", &stop, true },
|
||||
|
||||
/* P2P networking */
|
||||
{ "network", "getnetworkinfo", &getnetworkinfo, true },
|
||||
{ "network", "addnode", &addnode, true },
|
||||
{ "network", "disconnectnode", &disconnectnode, true },
|
||||
{ "network", "getaddednodeinfo", &getaddednodeinfo, true },
|
||||
{ "network", "getconnectioncount", &getconnectioncount, true },
|
||||
{ "network", "getnettotals", &getnettotals, true },
|
||||
{ "network", "getpeerinfo", &getpeerinfo, true },
|
||||
{ "network", "ping", &ping, true },
|
||||
{ "network", "setban", &setban, true },
|
||||
{ "network", "listbanned", &listbanned, true },
|
||||
{ "network", "clearbanned", &clearbanned, true },
|
||||
{ "network", "setnetworkactive", &setnetworkactive, true },
|
||||
|
||||
/* Block chain and UTXO */
|
||||
{ "blockchain", "getblockchaininfo", &getblockchaininfo, true },
|
||||
{ "blockchain", "getbestblockhash", &getbestblockhash, true },
|
||||
{ "blockchain", "getblockcount", &getblockcount, true },
|
||||
{ "blockchain", "getblock", &getblock, true },
|
||||
{ "blockchain", "getblockhashes", &getblockhashes, true },
|
||||
{ "blockchain", "getblockhash", &getblockhash, true },
|
||||
{ "blockchain", "getblockheader", &getblockheader, true },
|
||||
{ "blockchain", "getblockheaders", &getblockheaders, true },
|
||||
{ "blockchain", "getchaintips", &getchaintips, true },
|
||||
{ "blockchain", "getdifficulty", &getdifficulty, true },
|
||||
{ "blockchain", "getmempoolinfo", &getmempoolinfo, true },
|
||||
{ "blockchain", "getrawmempool", &getrawmempool, true },
|
||||
{ "blockchain", "gettxout", &gettxout, true },
|
||||
{ "blockchain", "gettxoutproof", &gettxoutproof, true },
|
||||
{ "blockchain", "verifytxoutproof", &verifytxoutproof, true },
|
||||
{ "blockchain", "gettxoutsetinfo", &gettxoutsetinfo, true },
|
||||
{ "blockchain", "verifychain", &verifychain, true },
|
||||
{ "blockchain", "getspentinfo", &getspentinfo, false },
|
||||
|
||||
/* Mining */
|
||||
{ "mining", "getblocktemplate", &getblocktemplate, true },
|
||||
{ "mining", "getmininginfo", &getmininginfo, true },
|
||||
{ "mining", "getnetworkhashps", &getnetworkhashps, true },
|
||||
{ "mining", "prioritisetransaction", &prioritisetransaction, true },
|
||||
{ "mining", "submitblock", &submitblock, true },
|
||||
|
||||
/* Coin generation */
|
||||
{ "generating", "generate", &generate, true },
|
||||
{ "generating", "generatetoaddress", &generatetoaddress, true },
|
||||
|
||||
/* Raw transactions */
|
||||
{ "rawtransactions", "createrawtransaction", &createrawtransaction, true },
|
||||
{ "rawtransactions", "decoderawtransaction", &decoderawtransaction, true },
|
||||
{ "rawtransactions", "decodescript", &decodescript, true },
|
||||
{ "rawtransactions", "getrawtransaction", &getrawtransaction, true },
|
||||
{ "rawtransactions", "sendrawtransaction", &sendrawtransaction, false },
|
||||
{ "rawtransactions", "signrawtransaction", &signrawtransaction, false }, /* uses wallet if enabled */
|
||||
|
||||
/* Address index */
|
||||
{ "addressindex", "getaddressmempool", &getaddressmempool, true },
|
||||
{ "addressindex", "getaddressutxos", &getaddressutxos, false },
|
||||
{ "addressindex", "getaddressdeltas", &getaddressdeltas, false },
|
||||
{ "addressindex", "getaddresstxids", &getaddresstxids, false },
|
||||
{ "addressindex", "getaddressbalance", &getaddressbalance, false },
|
||||
|
||||
/* Utility functions */
|
||||
{ "util", "createmultisig", &createmultisig, true },
|
||||
{ "util", "validateaddress", &validateaddress, true }, /* uses wallet if enabled */
|
||||
{ "util", "verifymessage", &verifymessage, true },
|
||||
{ "util", "estimatefee", &estimatefee, true },
|
||||
{ "util", "estimatepriority", &estimatepriority, true },
|
||||
{ "util", "estimatesmartfee", &estimatesmartfee, true },
|
||||
{ "util", "estimatesmartpriority", &estimatesmartpriority, true },
|
||||
|
||||
/* Not shown in help */
|
||||
{ "hidden", "invalidateblock", &invalidateblock, true },
|
||||
{ "hidden", "reconsiderblock", &reconsiderblock, true },
|
||||
{ "hidden", "setmocktime", &setmocktime, true },
|
||||
/* Dash features */
|
||||
{ "dash", "masternode", &masternode, true },
|
||||
{ "dash", "masternodelist", &masternodelist, true },
|
||||
{ "dash", "masternodebroadcast", &masternodebroadcast, true },
|
||||
{ "dash", "gobject", &gobject, true },
|
||||
{ "dash", "getgovernanceinfo", &getgovernanceinfo, true },
|
||||
{ "dash", "getsuperblockbudget", &getsuperblockbudget, true },
|
||||
{ "dash", "voteraw", &voteraw, true },
|
||||
{ "dash", "mnsync", &mnsync, true },
|
||||
{ "dash", "spork", &spork, true },
|
||||
{ "dash", "getpoolinfo", &getpoolinfo, true },
|
||||
{ "dash", "sentinelping", &sentinelping, true },
|
||||
};
|
||||
|
||||
CRPCTable::CRPCTable()
|
||||
|
@ -180,89 +180,6 @@ extern std::string HelpExampleRpc(const std::string& methodname, const std::stri
|
||||
|
||||
extern void EnsureWalletIsUnlocked();
|
||||
|
||||
extern UniValue getconnectioncount(const UniValue& params, bool fHelp); // in rpc/net.cpp
|
||||
extern UniValue getaddressmempool(const UniValue& params, bool fHelp);
|
||||
extern UniValue getaddressutxos(const UniValue& params, bool fHelp);
|
||||
extern UniValue getaddressdeltas(const UniValue& params, bool fHelp);
|
||||
extern UniValue getaddresstxids(const UniValue& params, bool fHelp);
|
||||
extern UniValue getaddressbalance(const UniValue& params, bool fHelp);
|
||||
|
||||
extern UniValue getpeerinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue ping(const UniValue& params, bool fHelp);
|
||||
extern UniValue addnode(const UniValue& params, bool fHelp);
|
||||
extern UniValue disconnectnode(const UniValue& params, bool fHelp);
|
||||
extern UniValue getaddednodeinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue getnettotals(const UniValue& params, bool fHelp);
|
||||
extern UniValue setban(const UniValue& params, bool fHelp);
|
||||
extern UniValue listbanned(const UniValue& params, bool fHelp);
|
||||
extern UniValue clearbanned(const UniValue& params, bool fHelp);
|
||||
extern UniValue setnetworkactive(const UniValue& params, bool fHelp);
|
||||
|
||||
extern UniValue generate(const UniValue& params, bool fHelp);
|
||||
extern UniValue generatetoaddress(const UniValue& params, bool fHelp);
|
||||
extern UniValue getnetworkhashps(const UniValue& params, bool fHelp);
|
||||
extern UniValue getmininginfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue prioritisetransaction(const UniValue& params, bool fHelp);
|
||||
extern UniValue getblocktemplate(const UniValue& params, bool fHelp);
|
||||
extern UniValue submitblock(const UniValue& params, bool fHelp);
|
||||
extern UniValue estimatefee(const UniValue& params, bool fHelp);
|
||||
extern UniValue estimatepriority(const UniValue& params, bool fHelp);
|
||||
extern UniValue estimatesmartfee(const UniValue& params, bool fHelp);
|
||||
extern UniValue estimatesmartpriority(const UniValue& params, bool fHelp);
|
||||
|
||||
extern UniValue verifymessage(const UniValue& params, bool fHelp);
|
||||
extern UniValue createmultisig(const UniValue& params, bool fHelp);
|
||||
extern UniValue validateaddress(const UniValue& params, bool fHelp);
|
||||
extern UniValue getinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue debug(const UniValue& params, bool fHelp);
|
||||
extern UniValue getblockchaininfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue getnetworkinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue setmocktime(const UniValue& params, bool fHelp);
|
||||
|
||||
extern UniValue getrawtransaction(const UniValue& params, bool fHelp); // in rpc/rawtransaction.cpp
|
||||
extern UniValue listunspent(const UniValue& params, bool fHelp);
|
||||
extern UniValue lockunspent(const UniValue& params, bool fHelp);
|
||||
extern UniValue listlockunspent(const UniValue& params, bool fHelp);
|
||||
extern UniValue createrawtransaction(const UniValue& params, bool fHelp);
|
||||
extern UniValue decoderawtransaction(const UniValue& params, bool fHelp);
|
||||
extern UniValue decodescript(const UniValue& params, bool fHelp);
|
||||
extern UniValue signrawtransaction(const UniValue& params, bool fHelp);
|
||||
extern UniValue sendrawtransaction(const UniValue& params, bool fHelp);
|
||||
extern UniValue gettxoutproof(const UniValue& params, bool fHelp);
|
||||
extern UniValue verifytxoutproof(const UniValue& params, bool fHelp);
|
||||
|
||||
extern UniValue privatesend(const UniValue& params, bool fHelp);
|
||||
extern UniValue getpoolinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue spork(const UniValue& params, bool fHelp);
|
||||
extern UniValue masternode(const UniValue& params, bool fHelp);
|
||||
extern UniValue masternodelist(const UniValue& params, bool fHelp);
|
||||
extern UniValue masternodebroadcast(const UniValue& params, bool fHelp);
|
||||
extern UniValue gobject(const UniValue& params, bool fHelp);
|
||||
extern UniValue getgovernanceinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue getsuperblockbudget(const UniValue& params, bool fHelp);
|
||||
extern UniValue voteraw(const UniValue& params, bool fHelp);
|
||||
extern UniValue mnsync(const UniValue& params, bool fHelp);
|
||||
|
||||
extern UniValue getblockcount(const UniValue& params, bool fHelp); // in rpc/blockchain.cpp
|
||||
extern UniValue getbestblockhash(const UniValue& params, bool fHelp);
|
||||
extern UniValue getdifficulty(const UniValue& params, bool fHelp);
|
||||
extern UniValue settxfee(const UniValue& params, bool fHelp);
|
||||
extern UniValue getmempoolinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue getrawmempool(const UniValue& params, bool fHelp);
|
||||
extern UniValue getblockhashes(const UniValue& params, bool fHelp);
|
||||
extern UniValue getblockhash(const UniValue& params, bool fHelp);
|
||||
extern UniValue getblockheader(const UniValue& params, bool fHelp);
|
||||
extern UniValue getblockheaders(const UniValue& params, bool fHelp);
|
||||
extern UniValue getblock(const UniValue& params, bool fHelp);
|
||||
extern UniValue gettxoutsetinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue gettxout(const UniValue& params, bool fHelp);
|
||||
extern UniValue verifychain(const UniValue& params, bool fHelp);
|
||||
extern UniValue getchaintips(const UniValue& params, bool fHelp);
|
||||
extern UniValue invalidateblock(const UniValue& params, bool fHelp);
|
||||
extern UniValue reconsiderblock(const UniValue& params, bool fHelp);
|
||||
extern UniValue getspentinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue sentinelping(const UniValue& params, bool fHelp);
|
||||
|
||||
bool StartRPC();
|
||||
void InterruptRPC();
|
||||
void StopRPC();
|
||||
|
@ -35,7 +35,7 @@ UniValue CallRPC(string args)
|
||||
string strMethod = vArgs[0];
|
||||
vArgs.erase(vArgs.begin());
|
||||
UniValue params = RPCConvertValues(strMethod, vArgs);
|
||||
|
||||
BOOST_CHECK(tableRPC[strMethod]);
|
||||
rpcfn_type method = tableRPC[strMethod]->actor;
|
||||
try {
|
||||
UniValue result = (*method)(params, false);
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "txdb.h"
|
||||
#include "txmempool.h"
|
||||
#include "ui_interface.h"
|
||||
#include "rpc/server.h"
|
||||
#include "rpc/register.h"
|
||||
#ifdef ENABLE_WALLET
|
||||
#include "wallet/db.h"
|
||||
#include "wallet/wallet.h"
|
||||
@ -57,9 +59,12 @@ BasicTestingSetup::~BasicTestingSetup()
|
||||
TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(chainName)
|
||||
{
|
||||
const CChainParams& chainparams = Params();
|
||||
// Ideally we'd move all the RPC tests to the functional testing framework
|
||||
// instead of unit tests, but for now we need these here.
|
||||
RegisterAllCoreRPCCommands(tableRPC);
|
||||
#ifdef ENABLE_WALLET
|
||||
bitdb.MakeMock();
|
||||
walletRegisterRPCCommands();
|
||||
RegisterWalletRPCCommands(tableRPC);
|
||||
#endif
|
||||
ClearDatadirCache();
|
||||
pathTemp = GetTempPath() / strprintf("test_dash_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));
|
||||
|
@ -2729,9 +2729,10 @@ extern UniValue dumphdinfo(const UniValue& params, bool fHelp);
|
||||
extern UniValue importelectrumwallet(const UniValue& params, bool fHelp);
|
||||
|
||||
extern UniValue instantsendtoaddress(const UniValue& params, bool fHelp);
|
||||
extern UniValue privatesend(const UniValue& params, bool fHelp);
|
||||
extern UniValue keepass(const UniValue& params, bool fHelp);
|
||||
|
||||
const CRPCCommand vWalletRPCCommands[] =
|
||||
static const CRPCCommand commands[] =
|
||||
{ // category name actor (function) okSafeMode
|
||||
// --------------------- ------------------------ ----------------------- ----------
|
||||
{ "rawtransactions", "fundrawtransaction", &fundrawtransaction, false },
|
||||
@ -2788,14 +2789,8 @@ const CRPCCommand vWalletRPCCommands[] =
|
||||
{ "dash", "privatesend", &privatesend, false },
|
||||
};
|
||||
|
||||
void walletRegisterRPCCommands()
|
||||
void RegisterWalletRPCCommands(CRPCTable &tableRPC)
|
||||
{
|
||||
unsigned int vcidx;
|
||||
for (vcidx = 0; vcidx < ARRAYLEN(vWalletRPCCommands); vcidx++)
|
||||
{
|
||||
const CRPCCommand *pcmd;
|
||||
|
||||
pcmd = &vWalletRPCCommands[vcidx];
|
||||
tableRPC.appendCommand(pcmd->name, pcmd);
|
||||
}
|
||||
for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
|
||||
tableRPC.appendCommand(commands[vcidx].name, &commands[vcidx]);
|
||||
}
|
||||
|
@ -5,6 +5,8 @@
|
||||
#ifndef BITCOIN_WALLET_RPCWALLET_H
|
||||
#define BITCOIN_WALLET_RPCWALLET_H
|
||||
|
||||
void walletRegisterRPCCommands();
|
||||
class CRPCTable;
|
||||
|
||||
void RegisterWalletRPCCommands(CRPCTable &tableRPC);
|
||||
|
||||
#endif //BITCOIN_WALLET_RPCWALLET_H
|
||||
|
Loading…
Reference in New Issue
Block a user