mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-06 21:57:54 +02:00
fadf901fd4rpc: Run type check on decodepsbt result (MarcoFalke)fa4d5891b9refactor: Introduce TxDocOptions (MarcoFalke)fa8250e961refactor: 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: tACKfadf901fd4achow101: ACKfadf901fd4willcl-ark: ACKfadf901fd4satsfy: re-ACKfadf901fd4seduless: re-ACKfadf901fd4Tree-SHA512: 4fb000dba9fe39bcd2bac72e2d88553f54134a250c985b4ca7150b483d7185009047d8fe4ba75c522bfc26706de20c913b8905e7552ab0c41802ae744cb92038