diff options
author | Karl-Johan Alm <karljohan-alm@garage.co.jp> | 2019-06-20 02:39:38 +0900 |
---|---|---|
committer | Karl-Johan Alm <karljohan-alm@garage.co.jp> | 2019-07-05 11:22:02 +0900 |
commit | 5c5e32bbe3dfa790dd8bb421fbd6301ae10b09f5 (patch) | |
tree | 8dcdcbeae96f2a7fb03b36bfa50d269b6bc68749 /src/rpc/server.cpp | |
parent | 0ab8ba1ac65b70f044a5e323b13d098cef33695a (diff) |
rpc: migrate JSONRPCRequest functionality into request.cpp
Diffstat (limited to 'src/rpc/server.cpp')
-rw-r--r-- | src/rpc/server.cpp | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index ca17d379bc..8b7b517473 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -329,39 +329,6 @@ bool RPCIsInWarmup(std::string *outStatus) return fRPCInWarmup; } -void JSONRPCRequest::parse(const UniValue& valRequest) -{ - // Parse request - if (!valRequest.isObject()) - throw JSONRPCError(RPC_INVALID_REQUEST, "Invalid Request object"); - const UniValue& request = valRequest.get_obj(); - - // Parse id now so errors from here on will have the id - id = find_value(request, "id"); - - // Parse method - UniValue valMethod = find_value(request, "method"); - if (valMethod.isNull()) - throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method"); - if (!valMethod.isStr()) - throw JSONRPCError(RPC_INVALID_REQUEST, "Method must be a string"); - strMethod = valMethod.get_str(); - if (fLogIPs) - LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s peeraddr=%s\n", SanitizeString(strMethod), - this->authUser, this->peerAddr); - else - LogPrint(BCLog::RPC, "ThreadRPCServer method=%s user=%s\n", SanitizeString(strMethod), this->authUser); - - // Parse params - UniValue valParams = find_value(request, "params"); - if (valParams.isArray() || valParams.isObject()) - params = valParams; - else if (valParams.isNull()) - params = UniValue(UniValue::VARR); - else - throw JSONRPCError(RPC_INVALID_REQUEST, "Params must be an array or object"); -} - bool IsDeprecatedRPCEnabled(const std::string& method) { const std::vector<std::string> enabled_methods = gArgs.GetArgs("-deprecatedrpc"); |