test/mutation: check wallet listings and wrapped P2WSH addresses in wallet_migration.py #36968

Open
l0rinc wants to merge 3 commits from l0rinc/test-wallet-migration-listing-checks into master AGit
l0rinc commented 2026-11-24 18:43:40 +00:00 (Migrated from github.com)

Problem: The migration test checks the legacy-wallet warning only if it finds the wallet in listwalletdir, so a missing wallet goes unnoticed.
It skips the warning check for path/to/trailing/ even when the wallet is listed because the returned name has no trailing separator.
After migration, the test looks for a dictionary containing only the backup name, but every entry also has a warnings field, so the check passes even if the backup is listed.

The P2WSH test imports a wrapped output but checks only the native address after migration.

Fix: Require listwalletdir to return the legacy wallet with its migration warning, then check that the backup filename is absent from the listed names after migration.
For both the native and wrapped addresses, check that getaddressinfo reports ismine as true and includes the embedded field.

Mutation tests: To test each change, apply the mutation in its commit message and run wallet_migration.py.

**Problem:** The migration test checks the legacy-wallet warning only if it finds the wallet in `listwalletdir`, so a missing wallet goes unnoticed. It skips the warning check for `path/to/trailing/` even when the wallet is listed because the returned name has no trailing separator. After migration, the test looks for a dictionary containing only the backup name, but every entry also has a `warnings` field, so the check passes even if the backup is listed. The P2WSH test imports a wrapped output but checks only the native address after migration. **Fix:** Require `listwalletdir` to return the legacy wallet with its migration warning, then check that the backup filename is absent from the listed names after migration. For both the native and wrapped addresses, check that `getaddressinfo` reports `ismine` as true and includes the `embedded` field. **Mutation tests:** To test each change, apply the mutation in its commit message and run `wallet_migration.py`.
DrahtBot commented 2026-11-24 18:43:49 +00:00 (Migrated from github.com)

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

External sites

Reviews

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #36257 (qa: assert_equal -> 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.

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36968 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36968.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36968#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) 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](https://github.com/bitcoin/bitcoin/pull/36257) <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36257.svg"></sub> (qa: assert_equal -> 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-->
First-time contributor

No findings were published from this review.

Review coverage was incomplete.


Reviewed: 6e765add24b6 · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:806938d40e279b6d701b2e78128bb1a09b55193a0b697245a1dce6241d3081c1:3607c760b63c01fb7f1f349adfc3fd0614b148a7df02e42f2f0edc2d448925a1 --> <!-- ralph-base:0e8f70a86314bc73539b110d947c41d40c4886fc --> <!-- ralph-head:6e765add24b6e63385dbcab7b2b66cb67a44af91 --> <!-- ralph-case:84aa96a210618e33d52fa70e357b41136fb0553c5398b7aa6ce0b349363f6525 --> No findings were published from this review. Review coverage was incomplete. <!-- Review tier: routine --> --- Reviewed: [`6e765add24b6`](<https://git.fish.foo/bitcoin/bitcoin/commit/6e765add24b6e63385dbcab7b2b66cb67a44af91>) · [Review report](<https://review.fish.foo/report/36968-6e765add24b6e63385dbcab7b2b66cb67a44af91-3197-4.html>) · [Previous reports](<https://review.fish.foo/traces/36968/>) [permalink](<https://review.fish.foo/report/36968-6e765add24b6e63385dbcab7b2b66cb67a44af91-3197-4.html>)
maflcko commented 2026-11-24 18:58:46 +00:00 (Migrated from github.com)

I think it is better to share mutations via a git diff, and not via some bash script

I think it is better to share mutations via a git diff, and not via some bash script
l0rinc commented 2026-11-24 20:41:01 +00:00 (Migrated from github.com)

share mutations via a git diff

I wanted to avoid adding 9 more lines to a commit message, but if this is simpler for reviewers, I don't mind: pushed, thanks.

> share mutations via a git diff I wanted to avoid adding 9 more lines to a commit message, but if this is simpler for reviewers, I don't mind: pushed, thanks.
DrahtBot commented 2026-11-25 21:43:05 +00:00 (Migrated from github.com)

🐙 This pull request conflicts with the target branch and needs rebase.

<!--cf906140f33d8803c4a75a2196329ecb--> 🐙 This pull request conflicts with the target branch and [needs rebase](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#rebasing-changes).
l0rinc commented 2026-11-26 12:22:40 +00:00 (Migrated from github.com)

Rebased on #34193, kept its cleanup check, and limited the pre-migration listwalletdir check to wallets it can list.

Rebased on #34193, kept its cleanup check, and limited the pre-migration `listwalletdir` check to wallets it can list.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36968
No description provided.