| 480 | } |
| 481 | |
| 482 | UniValue CRPCTable::execute(const JSONRPCRequest &request) const |
| 483 | { |
| 484 | // Return immediately if in warmup |
| 485 | { |
| 486 | LOCK(g_rpc_warmup_mutex); |
| 487 | if (fRPCInWarmup) |
| 488 | throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus); |
| 489 | } |
| 490 | |
| 491 | // Find method |
| 492 | auto it = mapCommands.find(request.strMethod); |
| 493 | if (it != mapCommands.end()) { |
| 494 | UniValue result; |
| 495 | if (ExecuteCommands(it->second, request, result)) { |
| 496 | return result; |
| 497 | } |
| 498 | } |
| 499 | throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found"); |
| 500 | } |
| 501 | |
| 502 | static bool ExecuteCommand(const CRPCCommand& command, const JSONRPCRequest& request, UniValue& result, bool last_handler) |
| 503 | { |