refactor: `wallet_importdescriptors` to separate `run_test()` contents into specific functions #36402

pull nebula-21 wants to merge 1 commits into bitcoin:master from nebula-21:refactor-wallet-importdescriptors-test changing 1 files +555 −494
  1. nebula-21 commented at 5:12 PM on October 1, 2026: contributor

    The motivation behind this PR came when reviewing a PR related with wallet_importdescriptors and I noticed that the run_test() function was more than 800 lines of code long, and looked messy and confusing, specially for someone not familiar with that test suite. I believe refactoring the contents inside run_test() and separating it into specific functions would make the test easier to understand and to add new future test cases.

    To review this PR, I recommend using the following command to easily see that the changes are only code movement and function organization:

    git show --color-moved=dimmed-zebra
    

    Suggestions about the new functions, organization, or their order are more than welcome. The approach I took is the one I felt would provide a good balance between keeping the code clean and making the changes as easy as possible to review.

    If reviewers would prefer to split this into multiple commits, I'm also happy to do so.

  2. DrahtBot added the label Refactoring on Oct 1, 2026
  3. DrahtBot commented at 5:12 PM on October 1, 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.

    Type Reviewers
    ACK polespinasa
    Concept ACK achow101

    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.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36648 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36648.svg"></sub> (descriptor, rpc, wallet: do not echo key material in error messages by fametrano)
    • #36444 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36444.svg"></sub> (wallet: Store information about created and imported multipath descriptors by achow101)
    • #36257 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36257.svg"></sub> (qa: assert_equals -> assert_true/assert_false by hodlinator)
    • #36005 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36005.svg"></sub> (rpc, descriptor: warn when multipath expansion clones single-path key expressions by pythcoiner)
    • #31668 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/31668.svg"></sub> (Added rescan option for import descriptors by saikiran57)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

    Possible typos and grammar issues:

    • test/functional/wallet_importdescriptors.py: we can use import and use multisig → we can import and use multisig [the original phrasing is grammatically broken]

    Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

    • test/functional/wallet_importdescriptors.py: multi_priv_big.sendtoaddress(w0.getnewaddress(), 10, "", "", True)

    <sup>2026-11-06 20:28:24</sup>

  4. w0xlt commented at 6:26 PM on October 1, 2026: contributor

    Approach aCK

  5. polespinasa commented at 8:53 PM on October 5, 2026: member

    Concept ACK

    There are some unnecessary new lines added and removed that add noise to the color-dimmed filter :)

  6. nebula-21 force-pushed on Oct 8, 2026
  7. nebula-21 commented at 3:19 PM on October 8, 2026: contributor

    Concept ACK

    There are some unnecessary new lines added and removed that add noise to the color-dimmed filter :)

    I've tried to avoid them as much as possible, but some of them are necessary to re-arrange into new functions keeping the separations of the original tests intact.

  8. DrahtBot added the label Needs rebase on Oct 9, 2026
  9. nebula-21 force-pushed on Oct 9, 2026
  10. nebula-21 commented at 12:25 PM on October 9, 2026: contributor

    Rebased on master

  11. DrahtBot removed the label Needs rebase on Oct 9, 2026
  12. in test/functional/wallet_importdescriptors.py:1169 in e46592815f
    1165 | @@ -1168,7 +1166,58 @@ def run_test(self):
    1166 |                  warnings=[expected_warning],
    1167 |              )
    1168 |  
    1169 | +    def test_combo_descriptors_activation(self):
    


    polespinasa commented at 6:30 PM on November 2, 2026:

    this does not only test combo descriptors, maybe should drop combo from the function name?


    nebula-21 commented at 12:11 PM on November 3, 2026:

    agree, changed!

  13. polespinasa commented at 6:38 PM on November 2, 2026: member

    I think this looks pretty good

  14. nebula-21 force-pushed on Nov 3, 2026
  15. nebula-21 force-pushed on Nov 3, 2026
  16. DrahtBot added the label CI failed on Nov 3, 2026
  17. DrahtBot removed the label CI failed on Nov 3, 2026
  18. achow101 commented at 8:54 PM on November 4, 2026: member

    Concept ACK

  19. refactor: `wallet_importdescriptors` to separate `run_test()` contents into specific functions 1dbe6869ce
  20. nebula-21 force-pushed on Nov 6, 2026
  21. nebula-21 commented at 8:30 PM on November 6, 2026: contributor

    1dbe6869cece7b839e88769b4209a3679c7bde93 addressed ralph's suggestion for test_next_index (line 938) to issue indices 0-4 from a different origin descriptor over the same xpub, to still test returning already handed-out scripts as it did before the refactor

  22. polespinasa commented at 12:46 PM on November 9, 2026: member

    ACK 1dbe6869cece7b839e88769b4209a3679c7bde93

  23. DrahtBot requested review from achow101 on Nov 9, 2026

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-11-24 05:51 UTC

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