mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-09 10:43:19 -05:00
rpc: allow empty JSON object result
This commit is contained in:
parent
bfbf91d0b2
commit
8d1a3e6498
2 changed files with 6 additions and 0 deletions
|
@ -830,6 +830,10 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case Type::OBJ_DYN:
|
case Type::OBJ_DYN:
|
||||||
|
case Type::OBJ_EMPTY: {
|
||||||
|
sections.PushSection({indent + maybe_key + "{}", Description("empty JSON object")});
|
||||||
|
return;
|
||||||
|
}
|
||||||
case Type::OBJ: {
|
case Type::OBJ: {
|
||||||
sections.PushSection({indent + maybe_key + "{", Description("json object")});
|
sections.PushSection({indent + maybe_key + "{", Description("json object")});
|
||||||
for (const auto& i : m_inner) {
|
for (const auto& i : m_inner) {
|
||||||
|
@ -879,6 +883,7 @@ bool RPCResult::MatchesType(const UniValue& result) const
|
||||||
return UniValue::VARR == result.getType();
|
return UniValue::VARR == result.getType();
|
||||||
}
|
}
|
||||||
case Type::OBJ_DYN:
|
case Type::OBJ_DYN:
|
||||||
|
case Type::OBJ_EMPTY:
|
||||||
case Type::OBJ: {
|
case Type::OBJ: {
|
||||||
return UniValue::VOBJ == result.getType();
|
return UniValue::VOBJ == result.getType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,6 +240,7 @@ struct RPCResult {
|
||||||
STR_AMOUNT, //!< Special string to represent a floating point amount
|
STR_AMOUNT, //!< Special string to represent a floating point amount
|
||||||
STR_HEX, //!< Special string with only hex chars
|
STR_HEX, //!< Special string with only hex chars
|
||||||
OBJ_DYN, //!< Special dictionary with keys that are not literals
|
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
|
ARR_FIXED, //!< Special array that has a fixed number of entries
|
||||||
NUM_TIME, //!< Special numeric to denote unix epoch time
|
NUM_TIME, //!< Special numeric to denote unix epoch time
|
||||||
ELISION, //!< Special type to denote elision (...)
|
ELISION, //!< Special type to denote elision (...)
|
||||||
|
|
Loading…
Add table
Reference in a new issue