| 19 | #include <rpc/blockchain.h> |
| 20 | |
| 21 | UniValue CallRPC(std::string args) |
| 22 | { |
| 23 | std::vector<std::string> vArgs; |
| 24 | boost::split(vArgs, args, boost::is_any_of(" \t")); |
| 25 | std::string strMethod = vArgs[0]; |
| 26 | vArgs.erase(vArgs.begin()); |
| 27 | JSONRPCRequest request; |
| 28 | request.strMethod = strMethod; |
| 29 | request.params = RPCConvertValues(strMethod, vArgs); |
| 30 | request.fHelp = false; |
| 31 | BOOST_CHECK(tableRPC[strMethod]); |
| 32 | rpcfn_type method = tableRPC[strMethod]->actor; |
| 33 | try { |
| 34 | UniValue result = (*method)(request); |
| 35 | return result; |
| 36 | } |
| 37 | catch (const UniValue& objError) { |
| 38 | throw std::runtime_error(find_value(objError, "message").get_str()); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | |
| 43 | BOOST_FIXTURE_TEST_SUITE(rpc_tests, TestingSetup) |
no test coverage detected