aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-03-29 19:43:02 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-03-31 10:48:32 +0200
commitfb8a8cf2e610920e9eee61c19ed6080af064bb43 (patch)
tree982b45be4ded75a296f459b78b38b38ccfe0594a /src/test
parent5131005e5b26d12b5b3f79c1c3f8ee08172fc386 (diff)
downloadbitcoin-fb8a8cf2e610920e9eee61c19ed6080af064bb43.tar.xz
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.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rpc_tests.cpp2
-rw-r--r--src/test/test_bitcoin.cpp7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp
index d6309ca384..1976ee2cb6 100644
--- a/src/test/rpc_tests.cpp
+++ b/src/test/rpc_tests.cpp
@@ -36,7 +36,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);
diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp
index dadc8b948f..1f2e034b01 100644
--- a/src/test/test_bitcoin.cpp
+++ b/src/test/test_bitcoin.cpp
@@ -17,6 +17,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"
@@ -53,9 +55,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_bitcoin_%lu_%i", (unsigned long)GetTime(), (int)(GetRand(100000)));