diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2021-12-13 13:24:17 +0700 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2021-12-24 16:28:53 +0100 |
commit | 8d1a3e6498de6087501969a9d243b0697ca3fe97 (patch) | |
tree | 78680f3559833bc5b8a151d721b0c8a140fad1d6 /src/rpc | |
parent | bfbf91d0b2004dde358253ac174982f784b43b59 (diff) |
rpc: allow empty JSON object result
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/util.cpp | 5 | ||||
-rw-r--r-- | src/rpc/util.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index 4a5cd0a4be..33b55707eb 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -830,6 +830,10 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const return; } case Type::OBJ_DYN: + case Type::OBJ_EMPTY: { + sections.PushSection({indent + maybe_key + "{}", Description("empty JSON object")}); + return; + } case Type::OBJ: { sections.PushSection({indent + maybe_key + "{", Description("json object")}); for (const auto& i : m_inner) { @@ -879,6 +883,7 @@ bool RPCResult::MatchesType(const UniValue& result) const return UniValue::VARR == result.getType(); } case Type::OBJ_DYN: + case Type::OBJ_EMPTY: case Type::OBJ: { return UniValue::VOBJ == result.getType(); } diff --git a/src/rpc/util.h b/src/rpc/util.h index d43ee33b0f..352a3e4e4e 100644 --- a/src/rpc/util.h +++ b/src/rpc/util.h @@ -240,6 +240,7 @@ struct RPCResult { 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 + OBJ_EMPTY, //!< Special type to allow empty OBJ ARR_FIXED, //!< Special array that has a fixed number of entries NUM_TIME, //!< Special numeric to denote unix epoch time ELISION, //!< Special type to denote elision (...) |