mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
@@ -830,16 +830,15 @@ 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: {
|
||||
if (m_inner.empty()) {
|
||||
sections.PushSection({indent + maybe_key + "{}", Description("empty JSON object")});
|
||||
return;
|
||||
}
|
||||
sections.PushSection({indent + maybe_key + "{", Description("json object")});
|
||||
for (const auto& i : m_inner) {
|
||||
i.ToSections(sections, OuterType::OBJ, current_indent + 2);
|
||||
}
|
||||
CHECK_NONFATAL(!m_inner.empty());
|
||||
if (m_type == Type::OBJ_DYN && m_inner.back().m_type != Type::ELISION) {
|
||||
// If the dictionary keys are dynamic, use three dots for continuation
|
||||
sections.PushSection({indent_next + "...", ""});
|
||||
@@ -883,7 +882,6 @@ 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();
|
||||
}
|
||||
@@ -891,6 +889,17 @@ bool RPCResult::MatchesType(const UniValue& result) const
|
||||
CHECK_NONFATAL(false);
|
||||
}
|
||||
|
||||
void RPCResult::CheckInnerDoc() const
|
||||
{
|
||||
if (m_type == Type::OBJ) {
|
||||
// May or may not be empty
|
||||
return;
|
||||
}
|
||||
// Everything else must either be empty or not
|
||||
const bool inner_needed{m_type == Type::ARR || m_type == Type::ARR_FIXED || m_type == Type::OBJ_DYN};
|
||||
CHECK_NONFATAL(inner_needed != m_inner.empty());
|
||||
}
|
||||
|
||||
std::string RPCArg::ToStringObj(const bool oneline) const
|
||||
{
|
||||
std::string res;
|
||||
|
||||
Reference in New Issue
Block a user