aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/util.h
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-11-23 10:41:27 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-04-01 12:16:28 +0200
commitfa8192f42e1d24444f1d0433c96dbce1adf76967 (patch)
treeac36014b0eda47a216e01977b7c6dc6940d288a8 /src/rpc/util.h
parent80a699fda9ff1129546cabbf17e955680a1cc705 (diff)
downloadbitcoin-fa8192f42e1d24444f1d0433c96dbce1adf76967.tar.xz
rpc: Fail to return undocumented return values
Diffstat (limited to 'src/rpc/util.h')
-rw-r--r--src/rpc/util.h5
1 files changed, 4 insertions, 1 deletions
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<UniValue(const RPCHelpMan&, const JSONRPCRequest&)>;
RPCHelpMan(std::string name, std::string description, std::vector<RPCArg> 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;