mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 05:32:22 +02:00
rpc: extract ListSinceBlockTxFields() helper
Extract the inline listsinceblock transaction field list into a reusable helper. The removed entry replaces its Type::ELISION placeholder with an empty string elision. ToSections() render an empty std::string elision as "...", and suppress the array continuation marker when the last inner element renders as a std::string elision.
This commit is contained in:
committed by
satsfy (Renato Britto)
parent
372ac283ac
commit
8a615a8800
@@ -1023,9 +1023,7 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
|
||||
}};
|
||||
|
||||
if (const auto* text = std::get_if<std::string>(&m_opts.print_elision)) {
|
||||
if (!text->empty()) {
|
||||
sections.PushSection({indent + "..." + maybe_separator, *text});
|
||||
}
|
||||
sections.PushSection({indent + "..." + maybe_separator, *text});
|
||||
return;
|
||||
}
|
||||
if (std::holds_alternative<HelpElisionSkip>(m_opts.print_elision)) {
|
||||
@@ -1077,7 +1075,7 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
|
||||
}
|
||||
CHECK_NONFATAL(!m_inner.empty());
|
||||
CHECK_NONFATAL(elision_has_description(m_inner));
|
||||
if (m_type == Type::ARR && m_inner.back().m_type != Type::ELISION) {
|
||||
if (m_type == Type::ARR && m_inner.back().m_type != Type::ELISION && !std::holds_alternative<std::string>(m_inner.back().m_opts.print_elision)) {
|
||||
sections.PushSection({indent_next + "...", ""});
|
||||
} else {
|
||||
// Remove final comma, which would be invalid JSON
|
||||
|
||||
Reference in New Issue
Block a user