test: Add importdescriptors rpc error test coverage #35630

pull polespinasa wants to merge 3 commits into bitcoin:master from polespinasa:2026-07-01-addimportdescriptorstestcoverage changing 1 files +68 −1
  1. polespinasa commented at 12:06 PM on July 1, 2026: member

    In addition to #35179 (already merged) this adds more missing test coverage that was detected while rebasing #34861.

    The three tests added checks:

    • Locked wallet throws because of being locked if giving an empty importdescriptors request.
    • Invalid or missing timestamp throws as a top level RPC error and not a per-item error.
    • The order of the requests and the response is the same, even if failing or succeeding.
  2. test: Test a locked wallet rejects an empty importdescriptors request
    Co-authored-by: w0xlt <woltx@protonmail.com>
    2d53645582
  3. DrahtBot added the label Tests on Jul 1, 2026
  4. DrahtBot commented at 12:06 PM on July 1, 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/35630.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. test: test invalid or missing timestamp throws importdescriptors
    Also adds global_error to test_importdesc to make it able to test per-item errors or global RPC errors
    105420b2fb
  6. polespinasa force-pushed on Jul 1, 2026
  7. DrahtBot added the label CI failed on Jul 1, 2026
  8. test: test the result order of a multiple import request is correct 6ca82938bb
  9. polespinasa force-pushed on Jul 1, 2026
  10. DrahtBot removed the label CI failed on Jul 1, 2026
  11. polespinasa renamed this:
    test: Add importdescriptors rpc error coverage
    test: Add importdescriptors rpc error test coverage
    on Jul 1, 2026
  12. davidgumberg commented at 6:13 PM on July 1, 2026: contributor

    Why is it desirable to enforce the order in which these errors are enforced?

  13. brunoerg commented at 6:39 PM on July 1, 2026: contributor

    Why is it desirable to enforce the order in which these errors are enforced?

    +1

  14. polespinasa commented at 8:23 PM on July 1, 2026: member

    Why is it desirable to enforce the order in which these errors are enforced?

    Because the importdescriptors RPC response is an array. Not a json with key-value elements that can be used to match requests and responses. If the order is not kept if an import fail you cannot know which descriptor is the one that failed.

  15. davidgumberg commented at 9:49 PM on July 1, 2026: contributor

    @polespinasa That makes sense. What I mean is e.g. in https://github.com/bitcoin/bitcoin/pull/35630/changes/2d536455829b904138c8853d9aed636916373e94 it seems that the test is checking that even when the importdescriptors call is erroneous because it's passed an empty list of descriptors, that the error is for being locked and not for being an empty list of descriptors. I guess what I'm asking is why does it matter to enforce which error gets checked for first, that seems like an implementation detail, but maybe I have misunderstood what is being tested for there.


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-07-02 02:51 UTC

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