From fa8192f42e1d24444f1d0433c96dbce1adf76967 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Mon, 23 Nov 2020 10:41:27 +0100 Subject: rpc: Fail to return undocumented return values --- src/rpc/util.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/rpc/util.h') diff --git a/src/rpc/util.h b/src/rpc/util.h index 94c2d2d626..db7f626e9c 100644 --- a/src/rpc/util.h +++ b/src/rpc/util.h @@ -223,6 +223,7 @@ struct RPCResult { NUM, BOOL, NONE, + ANY, //!< Special type to disable type checks (for testing only) STR_AMOUNT, //!< Special string to represent a floating point amount STR_HEX, //!< Special string with only hex chars OBJ_DYN, //!< Special dictionary with keys that are not literals @@ -295,6 +296,8 @@ struct RPCResult { std::string ToStringObj() const; /** Return the description string, including the result type. */ std::string ToDescriptionString() const; + /** Check whether the result JSON type matches. */ + bool MatchesType(const UniValue& result) const; }; struct RPCResults { @@ -333,7 +336,7 @@ public: using RPCMethodImpl = std::function; RPCHelpMan(std::string name, std::string description, std::vector args, RPCResults results, RPCExamples examples, RPCMethodImpl fun); - UniValue HandleRequest(const JSONRPCRequest& request); + UniValue HandleRequest(const JSONRPCRequest& request) const; std::string ToString() const; /** Return the named args that need to be converted from string to another JSON type */ UniValue GetArgMap() const; -- cgit v1.2.3