rpc: Register calls where they are defined

Split out methods to every module, apart from 'help' and 'stop' which
are implemented in rpcserver.cpp itself.

- This makes it easier to add or remove RPC commands - no longer everything that includes
    rpcserver.h has to be rebuilt when there's a change there.
- Cleans up `rpc/server.h` by getting rid of the huge cluttered list of function definitions.
- Removes most of the bitcoin-specific code from rpcserver.cpp and .h.

Continues #7307 for the non-wallet.
This commit is contained in:
Wladimir J. van der Laan
2016-03-29 19:43:02 +02:00
committed by Jack Grigg
parent 4b184205e3
commit a9496b08b6
19 changed files with 182 additions and 161 deletions

View File

@@ -4363,7 +4363,7 @@ extern UniValue z_importwallet(const UniValue& params, bool fHelp);
extern UniValue z_getpaymentdisclosure(const UniValue& params, bool fHelp); // in rpcdisclosure.cpp
extern UniValue z_validatepaymentdisclosure(const UniValue &params, bool fHelp);
const CRPCCommand vWalletRPCCommands[] =
static const CRPCCommand commands[] =
{ // category name actor (function) okSafeMode
// --------------------- ------------------------ ----------------------- ----------
{ "rawtransactions", "fundrawtransaction", &fundrawtransaction, false },
@@ -4435,14 +4435,8 @@ const CRPCCommand vWalletRPCCommands[] =
{ "disclosure", "z_validatepaymentdisclosure", &z_validatepaymentdisclosure, true }
};
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]);
}