test: fix wallet tests that check the wrong wallet #36863

pull w0xlt wants to merge 2 commits into bitcoin:master from w0xlt:test-wallet-restore-coverage-fixes changing 2 files +16 −14
  1. w0xlt commented at 9:34 PM on November 13, 2026: contributor

    wallet_keypool_topup.py is meant to test keypool restore for four output types, one node each. But the wallet and backup paths are only set for node1, so for nodes 2-4 the test copies node1's backup over node1's running wallet and restarts the node under test on its own, never-restored wallet. The checks still pass, so only the legacy case has actually been tested since 0dcac51049.

    This backs up and restores each node's own wallet, and asserts that the restored wallet rescans on startup so the test can't silently skip the restore again. Adding just that assertion on master makes the test fail at node2.

    Also fixes wallet_createwallet.py calling w7.walletpassphrase where it means w8 (since c5d3787367), so the avoid_reuse wallet was never checked.

  2. test: restore each node's own wallet backup in wallet_keypool_topup
    0dcac51049 extended this test to check keypool restore for every output
    type, one node each. However, the wallet and backup paths were only
    computed for node1, and only node1's wallet was backed up. For nodes
    2-4, the restore step copied node1's backup over node1's wallet while
    node1 was running, then restarted the node under test on its own,
    never-restored wallet. The p2sh-segwit, bech32 and bech32m checks
    therefore passed trivially: that wallet had derived the keys and
    received the funds itself.
    
    Back up each node's wallet with backupwallet and restore that backup
    into the node under test. Assert that the restored wallet rescans on
    startup, so the test fails if a node is ever restarted without its
    backup again. Also update the docstring, which still described the
    original two-node test.
    215f8b828b
  3. test: check w8, not w7, after creating the avoid_reuse wallet
    Since c5d3787367 the avoid_reuse section of wallet_createwallet calls
    w7.walletpassphrase, repeating the assertion made on w7 just before it,
    so the w8 wallet it creates was never checked for encryption. Call it
    on w8 to check that creating a wallet with an empty passphrase and
    avoid_reuse=true leaves it unencrypted.
    13b2d21beb
  4. DrahtBot added the label Tests on Nov 13, 2026
  5. DrahtBot commented at 9:34 PM on November 13, 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.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36257 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36257.svg"></sub> (qa: assert_equals -> assert_true/assert_false by hodlinator)

    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-->

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-11-18 16:51 UTC

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