MCPcopy Create free account
hub / github.com/LUX-Core/lux / parse

Method parse

src/rpcserver.cpp:549–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

547}
548
549void JSONRequest::parse(const UniValue& valRequest)
550{
551 // Parse request
552 if (!valRequest.isObject())
553 throw JSONRPCError(RPC_INVALID_REQUEST, "Invalid Request object");
554 const UniValue& request = valRequest.get_obj();
555
556 // Parse id now so errors from here on will have the id
557 id = find_value(request, "id");
558
559 // Parse method
560 UniValue valMethod = find_value(request, "method");
561 if (valMethod.isNull())
562 throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method");
563 if (!valMethod.isStr())
564 throw JSONRPCError(RPC_INVALID_REQUEST, "Method must be a string");
565 strMethod = valMethod.get_str();
566 if (strMethod != "getblocktemplate")
567 LogPrint("rpc", "ThreadRPCServer method=%s\n", SanitizeString(strMethod));
568
569 // Parse params
570 UniValue valParams = find_value(request, "params");
571 if (valParams.isArray())
572 params = valParams.get_array();
573 else if (valParams.isNull())
574 params = UniValue(UniValue::VARR);
575 else
576 throw JSONRPCError(RPC_INVALID_REQUEST, "Params must be an array");
577}
578
579
580static UniValue JSONRPCExecOne(const UniValue& req)

Callers 3

postprocess_translationsFunction · 0.45
HTTPReq_JSONRPCFunction · 0.45
JSONRPCExecOneFunction · 0.45

Calls 9

JSONRPCErrorFunction · 0.85
LogPrintFunction · 0.85
SanitizeStringFunction · 0.85
isObjectMethod · 0.80
isStrMethod · 0.80
get_strMethod · 0.80
isArrayMethod · 0.80
UniValueClass · 0.70
isNullMethod · 0.45

Tested by

no test coverage detected