psbt: add new test vectors #36329

pull Sjors wants to merge 2 commits into bitcoin:master from Sjors:2026/09/psbt-test-vectors changing 2 files +14 −2
  1. Sjors commented at 5:22 PM on September 24, 2026: member

    Add the two new test vectors from:

    https://github.com/bitcoin/bips/pull/2275 additionally requires existing Combine vectors to run in both orders, so we do that here too.

  2. test: add BIP174 sighash combiner vector
    Test both input orders per bitcoin/bips#2275.
    029bc15f2c
  3. DrahtBot added the label PSBT on Sep 24, 2026
  4. DrahtBot commented at 5:22 PM on September 24, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36329.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK brunoerg, aaron-leeb

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. Sjors commented at 5:22 PM on September 24, 2026: member
  6. aaron-leeb commented at 4:42 AM on September 25, 2026: none

    ACK f2a0db6

    I tested the code locally and also did some code tracing to understand that the updates to combiner test are meant to run an additional test case where the last psbt is the first processed. The purpose is to ensure that no matter the order the psbts are processed, the underlying merge logic is order-independent

    Personal note: I now understand that the combinepsbt method uses dynamic dispatch to handle the RPC command "combinepsbt" received by the node and runs the C++ code from psbt.cpp line 838 where the merge takes place.

    The addition of the invalid psbt test data with <valuesize> not matching the expected <valuedata> for the psbt, checks that this code from psbt.h line 134 runs with expected behavior:

    if (remaining_after + expected_size != remaining_before) { throw std::ios_base::failure("Size of value was not the stated size");

  7. in test/functional/data/rpc_psbt.json:3 in f2a0db6309
       0 | @@ -1,5 +1,6 @@
       1 |  {
       2 |      "invalid" : [
       3 | +        "cHNidP8BADN0Af8HAAEAAAABAP8BAApzMXQo/wAAAAAB/wEDAQAAAQAAAAAAAAAAdgEAAABBAAkAAAAAAA==",
    


    brunoerg commented at 7:49 AM on September 25, 2026:

    nit: could move it to invalid_with_msg with its expected error.

    diff --git a/test/functional/data/rpc_psbt.json b/test/functional/data/rpc_psbt.json
    --- a/test/functional/data/rpc_psbt.json
    +++ b/test/functional/data/rpc_psbt.json
    @@ -1,6 +1,5 @@
     {
         "invalid" : [
    -        "cHNidP8BADN0Af8HAAEAAAABAP8BAApzMXQo/wAAAAAB/wEDAQAAAQAAAAAAAAAAdgEAAABBAAkAAAAAAA==",
             "AgAAAAEmgXE3Ht/yhek3re6ks3t4AAwFZsuzrWRkFxPKQhcb9gAAAABqRzBEAiBwsiRRI+a/R01gxbUMBD1MaRpd...
             "cHNidP8BAHUCAAAAASaBcTce3/KF6Tet7qSze3gADAVmy7OtZGQXE8pCFxv2AAAAAAD+////AtPf9QUAAAAAGXap...
             "cHNidP8BAP0KAQIAAAACqwlJoIxa98SbghL0F+LxWrP1wz3PFTghqBOfh3pbe+QAAAAAakcwRAIgR1lmF5fAGwNr...
    @@ -157,6 +156,10 @@
             [
                 "cHNidP8BAgQCAAAAAQMEAAAAAAEEAQEBBQECAQYBBwH7BAIAAAAAAQBSAgAAAAHBqiVuIUuWoYIvk95Cv/O18/+N...
                 "Required height based locktime is invalid (0)"
    +        ],
    +        [
    +            "cHNidP8BADN0Af8HAAEAAAABAP8BAApzMXQo/wAAAAAB/wEDAQAAAQAAAAAAAAAAdgEAAABBAAkAAAAAAA==",
    +            "Size of value was not the stated size"
             ]
         ],
         "valid" : [
    

    Sjors commented at 8:16 AM on September 25, 2026:

    Done


    aaron-leeb commented at 2:57 AM on September 27, 2026:

    Would there be any reason to do the same for the other "invalid" without a message for further clarity?

  8. brunoerg approved
  9. brunoerg commented at 7:53 AM on September 25, 2026: contributor

    ACK f2a0db6309681c8ddc2963f34fb8519441f6668f

    I'm re-running a mutation analysis for psbt, will have a result soon.

  10. test: add BIP174 invalid value size vector
    From bitcoin/bips#1971.
    6fa2f3974c
  11. Sjors force-pushed on Sep 25, 2026
  12. brunoerg commented at 8:25 AM on September 25, 2026: contributor

    reACK 6fa2f3974cbb69fb2086a8f89d300deec4486662

  13. DrahtBot requested review from aaron-leeb on Sep 27, 2026
  14. aaron-leeb commented at 2:59 AM on September 27, 2026: none

    reACK 6fa2f39


aaron-leeb

Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-09-28 10:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me