MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / execute

Method execute

src/rpcserver.cpp:502–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

500}
501
502UniValue CRPCTable::execute(const std::string &strMethod, const UniValue &params) const
503{
504 // Return immediately if in warmup
505 {
506 LOCK(cs_rpcWarmup);
507 if (fRPCInWarmup)
508 throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus);
509 }
510
511 // Find method
512 const CRPCCommand *pcmd = tableRPC[strMethod];
513 if (!pcmd)
514 throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found");
515
516 g_rpcSignals.PreCommand(*pcmd);
517
518 try
519 {
520 // Execute
521 return pcmd->actor(params, false);
522 }
523 catch (const std::exception& e)
524 {
525 throw JSONRPCError(RPC_MISC_ERROR, e.what());
526 }
527
528 g_rpcSignals.PostCommand(*pcmd);
529}
530
531std::string HelpExampleCli(string methodname, string args){
532 return "> bitcoin-cli " + methodname + " " + args + "\n";

Callers 3

HTTPReq_JSONRPCFunction · 0.45
JSONRPCExecOneFunction · 0.45
requestMethod · 0.45

Calls 1

JSONRPCErrorFunction · 0.85

Tested by

no test coverage detected