mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 10:42:13 +02:00
rpc: Run type check on decodepsbt result
For RPCResults, the type may be ELISION, which is confusing and brittle:
* The elision should only affect the help output, not the type.
* The type should be the real type, so that type checks can be run on
it.
Fix this issue by introducing a new print_elision option and using it
in decodepsbt.
This change will ensure that RPCResult::MatchesType is properly run.
Also, this clarifies the RPC output minimally:
```diff
--- a/decodepsbt
+++ b/decodepsbt
@@ -35,7 +35,7 @@ Result:
"inputs" : [ (json array)
{ (json object)
"non_witness_utxo" : { (json object, optional) Decoded network transaction for non-witness UTXOs
- ...
+ ... The layout is the same as the output of decoderawtransaction.
},
"witness_utxo" : { (json object, optional) Transaction output for witness UTXOs
"amount" : n, (numeric) The value in BTC
```
This commit is contained in:
@@ -294,6 +294,15 @@ struct RPCArg {
|
||||
|
||||
struct RPCResultOptions {
|
||||
bool skip_type_check{false};
|
||||
/// Whether to treat this as elided in the human-readable description, and
|
||||
/// possibly supply a description for the elision. Normally, there will be
|
||||
/// one string on any of the elided results, for example `Same output as
|
||||
/// verbosity = 1`, and all other elided strings will be empty.
|
||||
///
|
||||
/// - If nullopt: normal display.
|
||||
/// - If empty string: suppress from help.
|
||||
/// - If non-empty: show "..." with this description.
|
||||
std::optional<std::string> print_elision{std::nullopt};
|
||||
};
|
||||
// NOLINTNEXTLINE(misc-no-recursion)
|
||||
struct RPCResult {
|
||||
|
||||
Reference in New Issue
Block a user