aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2016-01-07 08:33:49 +0100
committerJonas Schnelli <dev@jonasschnelli.ch>2016-01-20 15:03:25 +0100
commitdd2dc400eed7c4e8521d1264d652ee32070d2c47 (patch)
tree89f56a6a0f1b6b38054a25bdff3678f3ccdc0fc1 /src/wallet
parente1060c56cca7eeab8e217eb7b416c16487fd175e (diff)
downloadbitcoin-dd2dc400eed7c4e8521d1264d652ee32070d2c47.tar.xz
[RPC, Wallet] Move RPC dispatch table registration to wallet/ code
Allow extending the rpc dispatch table by appending commands when server is not running.
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/rpcwallet.cpp67
-rw-r--r--src/wallet/rpcwallet.h10
-rw-r--r--src/wallet/wallet.h1
3 files changed, 78 insertions, 0 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index e68d646096..7509afdb95 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -2475,3 +2475,70 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
return result;
}
+
+extern UniValue dumpprivkey(const UniValue& params, bool fHelp); // in rpcdump.cpp
+extern UniValue importprivkey(const UniValue& params, bool fHelp);
+extern UniValue importaddress(const UniValue& params, bool fHelp);
+extern UniValue importpubkey(const UniValue& params, bool fHelp);
+extern UniValue dumpwallet(const UniValue& params, bool fHelp);
+extern UniValue importwallet(const UniValue& params, bool fHelp);
+
+const CRPCCommand vWalletRPCCommands[] =
+{ // category name actor (function) okSafeMode
+ // --------------------- ------------------------ ----------------------- ----------
+ { "rawtransactions", "fundrawtransaction", &fundrawtransaction, false },
+ { "hidden", "resendwallettransactions", &resendwallettransactions, true },
+ { "wallet", "abandontransaction", &abandontransaction, false },
+ { "wallet", "addmultisigaddress", &addmultisigaddress, true },
+ { "wallet", "backupwallet", &backupwallet, true },
+ { "wallet", "dumpprivkey", &dumpprivkey, true },
+ { "wallet", "dumpwallet", &dumpwallet, true },
+ { "wallet", "encryptwallet", &encryptwallet, true },
+ { "wallet", "getaccountaddress", &getaccountaddress, true },
+ { "wallet", "getaccount", &getaccount, true },
+ { "wallet", "getaddressesbyaccount", &getaddressesbyaccount, true },
+ { "wallet", "getbalance", &getbalance, false },
+ { "wallet", "getnewaddress", &getnewaddress, true },
+ { "wallet", "getrawchangeaddress", &getrawchangeaddress, true },
+ { "wallet", "getreceivedbyaccount", &getreceivedbyaccount, false },
+ { "wallet", "getreceivedbyaddress", &getreceivedbyaddress, false },
+ { "wallet", "gettransaction", &gettransaction, false },
+ { "wallet", "getunconfirmedbalance", &getunconfirmedbalance, false },
+ { "wallet", "getwalletinfo", &getwalletinfo, false },
+ { "wallet", "importprivkey", &importprivkey, true },
+ { "wallet", "importwallet", &importwallet, true },
+ { "wallet", "importaddress", &importaddress, true },
+ { "wallet", "importpubkey", &importpubkey, true },
+ { "wallet", "keypoolrefill", &keypoolrefill, true },
+ { "wallet", "listaccounts", &listaccounts, false },
+ { "wallet", "listaddressgroupings", &listaddressgroupings, false },
+ { "wallet", "listlockunspent", &listlockunspent, false },
+ { "wallet", "listreceivedbyaccount", &listreceivedbyaccount, false },
+ { "wallet", "listreceivedbyaddress", &listreceivedbyaddress, false },
+ { "wallet", "listsinceblock", &listsinceblock, false },
+ { "wallet", "listtransactions", &listtransactions, false },
+ { "wallet", "listunspent", &listunspent, false },
+ { "wallet", "lockunspent", &lockunspent, true },
+ { "wallet", "move", &movecmd, false },
+ { "wallet", "sendfrom", &sendfrom, false },
+ { "wallet", "sendmany", &sendmany, false },
+ { "wallet", "sendtoaddress", &sendtoaddress, false },
+ { "wallet", "setaccount", &setaccount, true },
+ { "wallet", "settxfee", &settxfee, true },
+ { "wallet", "signmessage", &signmessage, true },
+ { "wallet", "walletlock", &walletlock, true },
+ { "wallet", "walletpassphrasechange", &walletpassphrasechange, true },
+ { "wallet", "walletpassphrase", &walletpassphrase, true },
+};
+
+void walletRegisterRPCCommands()
+{
+ unsigned int vcidx;
+ for (vcidx = 0; vcidx < ARRAYLEN(vWalletRPCCommands); vcidx++)
+ {
+ const CRPCCommand *pcmd;
+
+ pcmd = &vWalletRPCCommands[vcidx];
+ tableRPC.appendCommand(pcmd->name, pcmd);
+ }
+}
diff --git a/src/wallet/rpcwallet.h b/src/wallet/rpcwallet.h
new file mode 100644
index 0000000000..42e8021afa
--- /dev/null
+++ b/src/wallet/rpcwallet.h
@@ -0,0 +1,10 @@
+// Copyright (c) 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_WALLET_RPCWALLET_H
+#define BITCOIN_WALLET_RPCWALLET_H
+
+void walletRegisterRPCCommands();
+
+#endif //BITCOIN_WALLET_RPCWALLET_H
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 2176a5ff66..ffc7dcbd2c 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -15,6 +15,7 @@
#include "wallet/crypter.h"
#include "wallet/wallet_ismine.h"
#include "wallet/walletdb.h"
+#include "wallet/rpcwallet.h"
#include <algorithm>
#include <map>