| 585 | } |
| 586 | |
| 587 | UniValue 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 | |
| 604 | bool RPCHelpMan::IsValidNumArgs(size_t num_args) const |
| 605 | { |