mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-02 07:50:44 +02:00
Merge #18508: RPC: Fix more formatting nits
f32ab443a98e622afa601372454310aef1f380be Bugfix: RPC: JSON null is not "None" (Luke Dashjr)
26dcf3958187cbdc9ffc9438a5eebfcaf607f7e9 Bugfix: RPC: Don't use a continuation elipsis after an elision elipsis (Luke Dashjr)
eca65caadcddf43b2dace111bd7e4b0a2a9556c2 Bugfix: RPC: Add missing commas and correct indentation of explicit ELISION (Luke Dashjr)
Pull request description:
1. listsinceblock had a double ellipsis (elision + continuation); this looks ugly, just one is needed.
2. Elision ellipsis wasn't getting a comma, so was truncated to `".."` by comma-removal code.
3. Elision ellipsis was indented incorrectly (as if it was a subitem).
4. Similarly, type "none" would get truncated to `"Non"`, when it should really be `"null"` anyway.
ACKs for top commit:
MarcoFalke:
ACK f32ab443a98e622afa601372454310aef1f380be 🐰
Tree-SHA512: 34e1c72673790ed11cdee838d64ea5e0ac498de19258df99d54b5322e003060123c65ad27ac2fd4729a1dfe52066a0629602a132b1ef85d4154affd99a065a3f
This commit is contained in:
commit
e35e118656
@ -606,11 +606,11 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
|
||||
switch (m_type) {
|
||||
case Type::ELISION: {
|
||||
// If the inner result is empty, use three dots for elision
|
||||
sections.PushSection({indent_next + "...", m_description});
|
||||
sections.PushSection({indent + "..." + maybe_separator, m_description});
|
||||
return;
|
||||
}
|
||||
case Type::NONE: {
|
||||
sections.PushSection({indent + "None", Description("json null")});
|
||||
sections.PushSection({indent + "null" + maybe_separator, Description("json null")});
|
||||
return;
|
||||
}
|
||||
case Type::STR: {
|
||||
@ -643,10 +643,10 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
|
||||
for (const auto& i : m_inner) {
|
||||
i.ToSections(sections, OuterType::ARR, current_indent + 2);
|
||||
}
|
||||
if (m_type == Type::ARR) {
|
||||
CHECK_NONFATAL(!m_inner.empty());
|
||||
if (m_type == Type::ARR && m_inner.back().m_type != Type::ELISION) {
|
||||
sections.PushSection({indent_next + "...", ""});
|
||||
} else {
|
||||
CHECK_NONFATAL(!m_inner.empty());
|
||||
// Remove final comma, which would be invalid JSON
|
||||
sections.m_sections.back().m_left.pop_back();
|
||||
}
|
||||
@ -659,11 +659,11 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
|
||||
for (const auto& i : m_inner) {
|
||||
i.ToSections(sections, OuterType::OBJ, current_indent + 2);
|
||||
}
|
||||
if (m_type == Type::OBJ_DYN) {
|
||||
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 + "...", ""});
|
||||
} else {
|
||||
CHECK_NONFATAL(!m_inner.empty());
|
||||
// Remove final comma, which would be invalid JSON
|
||||
sections.m_sections.back().m_left.pop_back();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user