test: deduplicate PSBT unknown-field coverage in `rpc_psbt.py` #36591

pull nebula-21 wants to merge 2 commits into bitcoin:master from nebula-21:test-dedup-psbt-unknown-fields changing 1 files +25 −24
  1. nebula-21 commented at 3:57 PM on October 21, 2026: contributor

    I've tested some mutations related to test coverage for PSBT unknown field merging and discovered an inconsistency.

    <details>

    If line 71 of psbt.cpp "unknown.insert(psbt.unknown.begin(), psbt.unknown.end());" (inside bool PartiallySignedTransaction::Merge(const PartiallySignedTransaction& psbt) function) is removed then, the expected test fails: "Test that combining PSBTs preserves unknown fields with the same and with distinct values per map."

    If line 434 of psbt.cpp "unknown.insert(input.unknown.begin(), input.unknown.end());" (inside bool PSBTInput::Merge(const PSBTInput& input) function), is removed, a different unexpected test fails: "Test that unknown values are just passed through".

    If line 537 of psbt.cpp "unknown.insert(output.unknown.begin(), output.unknown.end());" (inside bool PSBTOutput::Merge(const PSBTOutput& output) function), is removed, the expected test fails: "Test that combining PSBTs preserves unknown fields with the same and with distinct values per map.".

    </details>

    This PR solves this inconsistency. The old code did 3 different things:

    1. Test the pass-through of unknown values for walletprocesspsbt.
    2. Combine two v0 PSBTs with different unknown input keys and check that both keys survive.
    3. Combine implicit v0 PSBT with explicit v0 and check that both keys survive.

    Case 2 is already fully covered by the existing test_combinepsbt_preseves_unknown_fields so keeping it is redundant and misleading.

    Commit 40eba5eb20ba0041a6328ba3482fcc26ddbe0185 moves the old code into a new method called test_unknown_fields_passthrough and commit ef4310097bd651497a98a9d1bb59560a7055ae01 removes the redundant code of Case 2 and moves Case 3 inside test_combinepsbt_preserves_unknown_fields.

  2. test: extract unknown fields passthrough to its own method 40eba5eb20
  3. DrahtBot added the label Tests on Oct 21, 2026
  4. DrahtBot commented at 4:10 PM on October 21, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. DrahtBot added the label CI failed on Oct 21, 2026
  6. DrahtBot commented at 4:48 PM on October 21, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task lint: https://github.com/bitcoin/bitcoin/actions/runs/39630407161/job/119326813663</sub> <sub>LLM reason (✨ experimental): CI failed because lint checks found trailing whitespace on blank line 616 of test/functional/rpc_psbt.py, flagged by both Ruff and the trailing-whitespace check.</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>

  7. nebula-21 force-pushed on Oct 21, 2026
  8. test: combine redundant PSBT unknown field merge cases into `test_combinepsbt_preserves_unknown_fields` ef4310097b
  9. DrahtBot removed the label CI failed on Oct 21, 2026
Contributors
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-10-21 21:51 UTC

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