mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 05:32:22 +02:00
rpc: render Type::ANY in help text instead of aborting
RPCResult::Type::ANY triggers NONFATAL_UNREACHABLE() in ToSections(), which crashes the help() RPC when a command uses Type::ANY in a nested result field. Previously this was never hit because Type::ANY was only used as a top-level alternate result type, filtered out before ToSections() is called. getopenrpcinfo() will use this result type, so render it like other types allowing it to be used in nested result definitions like schema.
This commit is contained in:
@@ -1032,7 +1032,8 @@ void RPCResult::ToSections(Sections& sections, const OuterType outer_type, const
|
||||
|
||||
switch (m_type) {
|
||||
case Type::ANY: {
|
||||
NONFATAL_UNREACHABLE(); // Only for testing
|
||||
sections.PushSection({indent + maybe_key + "xxx" + maybe_separator, Description("any")});
|
||||
return;
|
||||
}
|
||||
case Type::NONE: {
|
||||
sections.PushSection({indent + "null" + maybe_separator, Description("json null")});
|
||||
|
||||
Reference in New Issue
Block a user