MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / CallRPC

Function CallRPC

src/test/rpc_tests.cpp:21–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#include <rpc/blockchain.h>
20
21UniValue 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
43BOOST_FIXTURE_TEST_SUITE(rpc_tests, TestingSetup)

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.70

Calls 3

RPCConvertValuesFunction · 0.85
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected