| 500 | } |
| 501 | |
| 502 | UniValue CRPCTable::execute(const std::string &strMethod, const UniValue ¶ms) 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 | |
| 531 | std::string HelpExampleCli(string methodname, string args){ |
| 532 | return "> bitcoin-cli " + methodname + " " + args + "\n"; |
no test coverage detected