mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
refactor: Replace JSONRPCRequest fHelp field with mode field
No change in behavior
This commit is contained in:
@@ -476,6 +476,18 @@ std::string RPCExamples::ToDescriptionString() const
|
||||
return m_examples.empty() ? m_examples : "\nExamples:\n" + m_examples;
|
||||
}
|
||||
|
||||
UniValue RPCHelpMan::HandleRequest(const JSONRPCRequest& request)
|
||||
{
|
||||
/*
|
||||
* Check if the given request is valid according to this command or if
|
||||
* the user is asking for help information, and throw help when appropriate.
|
||||
*/
|
||||
if (request.mode == JSONRPCRequest::GET_HELP || !IsValidNumArgs(request.params.size())) {
|
||||
throw std::runtime_error(ToString());
|
||||
}
|
||||
return m_fun(*this, request);
|
||||
}
|
||||
|
||||
bool RPCHelpMan::IsValidNumArgs(size_t num_args) const
|
||||
{
|
||||
size_t num_required_args = 0;
|
||||
|
||||
Reference in New Issue
Block a user