MCPcopy Create free account
hub / github.com/ElementsProject/elements / HandleRequest

Method HandleRequest

src/rpc/util.cpp:587–602  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

585}
586
587UniValue RPCHelpMan::HandleRequest(const JSONRPCRequest& request) const
588{
589 if (request.mode == JSONRPCRequest::GET_ARGS) {
590 return GetArgMap();
591 }
592 /*
593 * Check if the given request is valid according to this command or if
594 * the user is asking for help information, and throw help when appropriate.
595 */
596 if (request.mode == JSONRPCRequest::GET_HELP || !IsValidNumArgs(request.params.size())) {
597 throw std::runtime_error(ToString());
598 }
599 const UniValue ret = m_fun(*this, request);
600 CHECK_NONFATAL(std::any_of(m_results.m_results.begin(), m_results.m_results.end(), [&ret](const RPCResult& res) { return res.MatchesType(ret); }));
601 return ret;
602}
603
604bool RPCHelpMan::IsValidNumArgs(size_t num_args) const
605{

Callers 5

rest_chaininfoFunction · 0.80
BOOST_FIXTURE_TEST_CASEFunction · 0.80
claimpeginFunction · 0.80
getmininginfoFunction · 0.80
CRPCCommandMethod · 0.80

Calls 5

MatchesTypeMethod · 0.80
ToStringFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

BOOST_FIXTURE_TEST_CASEFunction · 0.64