From ab88ed93efbdfd583b8c769060f7bfe6928687a9 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 26 Mar 2014 12:26:43 +0100 Subject: [PATCH] Organize RPCCommands table Use sensible categories (overall control, P2P, blockchain/UTXO and mining, wallet, wallet-enabled mining) and sort within each. Also remove unnecessary #ifdef ENABLE_WALLET from `rpcnet.cpp`. Functionality-neutral change. --- src/rpcnet.cpp | 4 -- src/rpcserver.cpp | 105 +++++++++++++++++++++++++--------------------- 2 files changed, 57 insertions(+), 52 deletions(-) diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 3fe328772..1b56d9ae7 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -10,10 +10,6 @@ #include "protocol.h" #include "sync.h" #include "util.h" -#ifdef ENABLE_WALLET -#include "init.h" // for getinfo -#include "wallet.h" // for getinfo -#endif #include #include "json/json_spirit_value.h" diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 7ad73836a..d771a4242 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -222,86 +222,95 @@ Value stop(const Array& params, bool fHelp) static const CRPCCommand vRPCCommands[] = { // name actor (function) okSafeMode threadSafe reqWallet // ------------------------ ----------------------- ---------- ---------- --------- + /* Overall control/query calls */ + { "getinfo", &getinfo, true, false, false }, /* uses wallet if enabled */ { "help", &help, true, true, false }, { "stop", &stop, true, true, false }, - { "getblockcount", &getblockcount, true, false, false }, - { "getbestblockhash", &getbestblockhash, true, false, false }, - { "getconnectioncount", &getconnectioncount, true, false, false }, - { "getpeerinfo", &getpeerinfo, true, false, false }, - { "ping", &ping, true, false, false }, + + /* P2P networking */ { "addnode", &addnode, true, true, false }, { "getaddednodeinfo", &getaddednodeinfo, true, true, false }, + { "getconnectioncount", &getconnectioncount, true, false, false }, { "getnettotals", &getnettotals, true, true, false }, - { "getdifficulty", &getdifficulty, true, false, false }, - { "getinfo", &getinfo, true, false, false }, - { "getrawmempool", &getrawmempool, true, false, false }, + { "getpeerinfo", &getpeerinfo, true, false, false }, + { "ping", &ping, true, false, false }, + + /* Block chain and UTXO */ + { "getbestblockhash", &getbestblockhash, true, false, false }, + { "getblockcount", &getblockcount, true, false, false }, { "getblock", &getblock, false, false, false }, { "getblockhash", &getblockhash, false, false, false }, - { "getrawtransaction", &getrawtransaction, false, false, false }, - { "createrawtransaction", &createrawtransaction, false, false, false }, - { "decoderawtransaction", &decoderawtransaction, false, false, false }, - { "decodescript", &decodescript, false, false, false }, - { "signrawtransaction", &signrawtransaction, false, false, false }, - { "sendrawtransaction", &sendrawtransaction, false, false, false }, - { "gettxoutsetinfo", &gettxoutsetinfo, true, false, false }, + { "getdifficulty", &getdifficulty, true, false, false }, + { "getrawmempool", &getrawmempool, true, false, false }, { "gettxout", &gettxout, true, false, false }, + { "gettxoutsetinfo", &gettxoutsetinfo, true, false, false }, { "verifychain", &verifychain, true, false, false }, /* Mining */ - { "getnetworkhashps", &getnetworkhashps, true, false, false }, - { "getmininginfo", &getmininginfo, true, false, false }, { "getblocktemplate", &getblocktemplate, true, false, false }, + { "getmininginfo", &getmininginfo, true, false, false }, + { "getnetworkhashps", &getnetworkhashps, true, false, false }, { "submitblock", &submitblock, false, false, false }, - { "validateaddress", &validateaddress, true, false, false }, + + /* Raw transactions */ + { "createrawtransaction", &createrawtransaction, false, false, false }, + { "decoderawtransaction", &decoderawtransaction, false, false, false }, + { "decodescript", &decodescript, false, false, false }, + { "getrawtransaction", &getrawtransaction, false, false, false }, + { "sendrawtransaction", &sendrawtransaction, false, false, false }, + { "signrawtransaction", &signrawtransaction, false, false, false }, /* uses wallet if enabled */ + + /* Utility functions */ { "createmultisig", &createmultisig, true, true , false }, + { "validateaddress", &validateaddress, true, false, false }, /* uses wallet if enabled */ { "verifymessage", &verifymessage, false, false, false }, #ifdef ENABLE_WALLET /* Wallet */ - { "getnewaddress", &getnewaddress, true, false, true }, + { "addmultisigaddress", &addmultisigaddress, false, false, true }, + { "backupwallet", &backupwallet, true, false, true }, + { "dumpprivkey", &dumpprivkey, true, false, true }, + { "dumpwallet", &dumpwallet, true, false, true }, + { "encryptwallet", &encryptwallet, false, false, true }, { "getaccountaddress", &getaccountaddress, true, false, true }, - { "getrawchangeaddress", &getrawchangeaddress, true, false, true }, - { "setaccount", &setaccount, true, false, true }, { "getaccount", &getaccount, false, false, true }, { "getaddressesbyaccount", &getaddressesbyaccount, true, false, true }, - { "sendtoaddress", &sendtoaddress, false, false, true }, - { "getreceivedbyaddress", &getreceivedbyaddress, false, false, true }, - { "getreceivedbyaccount", &getreceivedbyaccount, false, false, true }, - { "listreceivedbyaddress", &listreceivedbyaddress, false, false, true }, - { "listreceivedbyaccount", &listreceivedbyaccount, false, false, true }, - { "backupwallet", &backupwallet, true, false, true }, - { "keypoolrefill", &keypoolrefill, true, false, true }, - { "walletpassphrase", &walletpassphrase, true, false, true }, - { "walletpassphrasechange", &walletpassphrasechange, false, false, true }, - { "walletlock", &walletlock, true, false, true }, - { "encryptwallet", &encryptwallet, false, false, true }, { "getbalance", &getbalance, false, false, true }, - { "getunconfirmedbalance", &getunconfirmedbalance, false, false, true }, - { "move", &movecmd, false, false, true }, - { "sendfrom", &sendfrom, false, false, true }, - { "sendmany", &sendmany, false, false, true }, - { "addmultisigaddress", &addmultisigaddress, false, false, true }, + { "getnewaddress", &getnewaddress, true, false, true }, + { "getrawchangeaddress", &getrawchangeaddress, true, false, true }, + { "getreceivedbyaccount", &getreceivedbyaccount, false, false, true }, + { "getreceivedbyaddress", &getreceivedbyaddress, false, false, true }, { "gettransaction", &gettransaction, false, false, true }, - { "listtransactions", &listtransactions, false, false, true }, - { "listaddressgroupings", &listaddressgroupings, false, false, true }, - { "signmessage", &signmessage, false, false, true }, - { "listaccounts", &listaccounts, false, false, true }, - { "listsinceblock", &listsinceblock, false, false, true }, - { "dumpprivkey", &dumpprivkey, true, false, true }, - { "dumpwallet", &dumpwallet, true, false, true }, + { "getunconfirmedbalance", &getunconfirmedbalance, false, false, true }, + { "getwalletinfo", &getwalletinfo, true, false, true }, { "importprivkey", &importprivkey, false, false, true }, { "importwallet", &importwallet, false, false, true }, + { "keypoolrefill", &keypoolrefill, true, false, true }, + { "listaccounts", &listaccounts, false, false, true }, + { "listaddressgroupings", &listaddressgroupings, false, false, true }, + { "listlockunspent", &listlockunspent, false, false, true }, + { "listreceivedbyaccount", &listreceivedbyaccount, false, false, true }, + { "listreceivedbyaddress", &listreceivedbyaddress, false, false, true }, + { "listsinceblock", &listsinceblock, false, false, true }, + { "listtransactions", &listtransactions, false, false, true }, { "listunspent", &listunspent, false, false, true }, { "lockunspent", &lockunspent, false, false, true }, - { "listlockunspent", &listlockunspent, false, false, true }, + { "move", &movecmd, false, false, true }, + { "sendfrom", &sendfrom, false, false, true }, + { "sendmany", &sendmany, false, false, true }, + { "sendtoaddress", &sendtoaddress, false, false, true }, + { "setaccount", &setaccount, true, false, true }, { "settxfee", &settxfee, false, false, true }, - { "getwalletinfo", &getwalletinfo, true, false, true }, + { "signmessage", &signmessage, false, false, true }, + { "walletlock", &walletlock, true, false, true }, + { "walletpassphrasechange", &walletpassphrasechange, false, false, true }, + { "walletpassphrase", &walletpassphrase, true, false, true }, /* Wallet-enabled mining */ { "getgenerate", &getgenerate, true, false, false }, - { "setgenerate", &setgenerate, true, true, false }, { "gethashespersec", &gethashespersec, true, false, false }, - { "getwork", &getwork, true, false, true }, + { "getwork", &getwork, true, false, true }, + { "setgenerate", &setgenerate, true, true, false }, #endif // ENABLE_WALLET };