rpc: render Type::ANY in help text instead of aborting
What changed, and why it matters
This is a small bug-fix in Bitcoin Core's RPC help system. A special placeholder result type called Type::ANY previously caused the help() command to crash with an 'unreachable' assertion when it appeared inside a nested result description. The change makes it render as 'xxx' with description 'any' instead, matching how other types are displayed. It is a denial-of-service-style crash only for the help() RPC output, not for transaction processing, consensus, or wallet operations.
Treat as a routine bug fix. No urgent security response is warranted. Reviewers may want to confirm that no other Type::ANY usages remain unhandled and that getopenrpcinfo() help output renders correctly after the change.
Security signals we found
Crash/assertion in RPC help generation (NONFATAL_UNREACHABLE)
Denial-of-service vector limited to help() RPC output
No consensus, networking, or wallet code affected
Fix is a one-line behavior change in a single utility function
Evidence from the diff
In src/rpc/util.cpp, RPCResult::ToSections() previously called NONFATAL_UNREACHABLE() for Type::ANY, causing a non-fatal abort when generating help text for any RPC whose nested result schema included Type::ANY. The patch replaces the unreachable assertion with a normal section push (indent + maybe_key + ‘xxx’ + maybe_separator, Description(‘any’)), consistent with other scalar/placeholder types. The commit message notes this was previously unhit because Type::ANY was only used as a top-level alternate result type filtered out before ToSections(), and that getopenrpcinfo() will use it nested.
Changed components
src/rpc/util.cppRPC help text generationhelp() RPC commandInspect captured patch +2 / −1
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index 410bb741..8c5ee303 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -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")});
Why this scored 22/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.