| 449 | } |
| 450 | |
| 451 | UniValue CRPCTable::execute(const JSONRPCRequest &request) const |
| 452 | { |
| 453 | // Return immediately if in warmup |
| 454 | { |
| 455 | LOCK(g_rpc_warmup_mutex); |
| 456 | if (fRPCInWarmup) |
| 457 | throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus); |
| 458 | } |
| 459 | |
| 460 | // Find method |
| 461 | auto it = mapCommands.find(request.strMethod); |
| 462 | if (it != mapCommands.end()) { |
| 463 | UniValue result; |
| 464 | if (ExecuteCommands(it->second, request, result)) { |
| 465 | return result; |
| 466 | } |
| 467 | } |
| 468 | throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found"); |
| 469 | } |
| 470 | |
| 471 | static bool ExecuteCommand(const CRPCCommand& command, const JSONRPCRequest& request, UniValue& result, bool last_handler) |
| 472 | { |