We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5c5e32b commit c7a9fc2Copy full SHA for c7a9fc2
src/rpc/util.h
@@ -243,6 +243,15 @@ class RPCHelpMan
243
std::string ToString() const;
244
/** If the supplied number of args is neither too small nor too high */
245
bool IsValidNumArgs(size_t num_args) const;
246
+ /**
247
+ * Check if the given request is valid according to this command or if
248
+ * the user is asking for help information, and throw help when appropriate.
249
+ */
250
+ inline void Check(const JSONRPCRequest& request) const {
251
+ if (request.fHelp || !IsValidNumArgs(request.params.size())) {
252
+ throw std::runtime_error(ToString());
253
+ }
254
255
256
private:
257
const std::string m_name;
0 commit comments