fadf901fd4 rpc: Run type check on decodepsbt result (MarcoFalke)
fa4d5891b9 refactor: Introduce TxDocOptions (MarcoFalke)
fa8250e961 refactor: Add and use RPCResultOptions (MarcoFalke)
Pull request description:
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.
Can be tested by introducing a bug:
```diff
diff --git a/src/core_io.cpp b/src/core_io.cpp
index 7492e9ca50..4927b70c8e 100644
--- a/src/core_io.cpp
+++ b/src/core_io.cpp
@@ -436,2 +436,3 @@ void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry
entry.pushKV("version", tx.version);
+ entry.pushKV("bug", "error!");
entry.pushKV("size", tx.ComputeTotalSize());
```
And then running (in a debug build) `decodepsbt cHNidP8BAAoCAAAAAAAAAAAAAA==`
Before, on master: passes
Now, on this pull: Properly detects the bug
ACKs for top commit:
nervana21:
tACK fadf901fd4
achow101:
ACK fadf901fd4
willcl-ark:
ACK fadf901fd4
satsfy:
re-ACK fadf901fd4
seduless:
re-ACK fadf901fd4
Tree-SHA512: 4fb000dba9fe39bcd2bac72e2d88553f54134a250c985b4ca7150b483d7185009047d8fe4ba75c522bfc26706de20c913b8905e7552ab0c41802ae744cb92038