Skip to content

Commit 8d1a3e6

Browse files
committed
rpc: allow empty JSON object result
1 parent bfbf91d commit 8d1a3e6

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/rpc/util.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,10 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
830830
return;
831831
}
832832
case Type::OBJ_DYN:
833+
case Type::OBJ_EMPTY: {
834+
sections.PushSection({indent + maybe_key + "{}", Description("empty JSON object")});
835+
return;
836+
}
833837
case Type::OBJ: {
834838
sections.PushSection({indent + maybe_key + "{", Description("json object")});
835839
for (const auto& i : m_inner) {
@@ -879,6 +883,7 @@ bool RPCResult::MatchesType(const UniValue& result) const
879883
return UniValue::VARR == result.getType();
880884
}
881885
case Type::OBJ_DYN:
886+
case Type::OBJ_EMPTY:
882887
case Type::OBJ: {
883888
return UniValue::VOBJ == result.getType();
884889
}

src/rpc/util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ struct RPCResult {
240240
STR_AMOUNT, //!< Special string to represent a floating point amount
241241
STR_HEX, //!< Special string with only hex chars
242242
OBJ_DYN, //!< Special dictionary with keys that are not literals
243+
OBJ_EMPTY, //!< Special type to allow empty OBJ
243244
ARR_FIXED, //!< Special array that has a fixed number of entries
244245
NUM_TIME, //!< Special numeric to denote unix epoch time
245246
ELISION, //!< Special type to denote elision (...)

0 commit comments

Comments
 (0)