Partially addresses #29912. Motivated by #34683, which exports OpenRPC from existing RPCHelpMan metadata. Sample OpenRPC.
Some RPC help definitions currently rely on RPCResult::Type::ELISION entries whose structure is only described in prose. This is concise for human-readable help, but it prevents tools from deriving complete machine-readable result schemas from the metadata.
This PR replaces all non-recursive ELISION-based reuses with shared structured definitions, so the result layout is represented directly in RPCHelpMan metadata instead of only in text.
Affected RPCs:
decodepsbtgetrawtransactiongetblocklistsinceblock
The patch also replaces DecodeTxDoc() with TxDoc() plus a TxDocOptions struct, so decoded transaction layouts can be reused without positional booleans and selectively extended with prevout, fee, and hex fields.
As a consequence, bitcoin-cli output for affected RPCs becomes more verbose, since prose summaries like “Same output as verbosity = 1” are replaced by the full field definitions. The actual RPC return values are unchanged. I opened this as a draft because I’d like to discuss whether this tradeoff is acceptable, or whether the help renderer should collapse some sub-structures via manual configuration back into short summaries while keeping the underlying metadata explicit.
This PR doesn’t cover getaddressinfo.embedded, which is recursive — runtime output can contain nested embedded objects, and RPCResult has no way to express that today. Happy to discuss approaches here if anyone has thoughts.
This PR also implements the fee field fix in getblock RPC result (PR #34702 also implements), which should be optional but is not marked as such.
Changes:
- replace
DecodeTxDoc()withTxDoc()andTxDocOptions - replace ELISION-based reuse in
decodepsbt,getrawtransaction,getblock, andlistsinceblock - factor shared result layouts into
TxDoc(),GetBlockFields(), andListSinceBlockTxFields() - mark
getblocktransactionfeedocumentation optional where it is conditionally present