Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
|
I think it is better to share mutations via a git diff, and not via some bash script |
wallet_migration.pywallet_migration.py
6883114 to
cc9a9a8
Compare
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. |
If `listwalletdir` omits the wallet, the loop never checks its warning and the test passes. The loop also skips `path/to/trailing/` because the listed name has no trailing separator. Match the wallet by its listed name and require the migration warning. With the following mutation, the original test passes and the new check fails because `basic0` is missing. ```diff diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index 3af0f1c..40a9917873 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -34,5 +34,4 @@ std::vector<std::pair<fs::path, std::string>> ListDatabases(const fs::path& wall if (IsBDBFile(BDBDataFile(it->path()))) { // Found a directory which contains wallet.dat btree file, add it as a wallet with BERKELEY format. - paths.emplace_back(path, "bdb"); } else if (IsSQLiteFile(SQLiteDataFile(it->path()))) { // Found a directory which contains wallet.dat sqlite file, add it as a wallet with SQLITE format. ```
Every wallet returned by `listwalletdir` has a `warnings` field, so checking that `{"name": backup_filename}` is absent passes even when the backup is listed.
Compare the backup filename with the listed names instead.
Removing the `.bak` filter makes `listwalletdir` return the backup, which the previous test accepts and the new check catches.
```diff
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp
index 3af0f1c..a2d41065ec 100644
--- a/src/wallet/db.cpp
+++ b/src/wallet/db.cpp
@@ -39,5 +39,5 @@ std::vector<std::pair<fs::path, std::string>> ListDatabases(const fs::path& wall
paths.emplace_back(path, "sqlite");
}
- } else if (it.depth() == 0 && it->symlink_status().type() == fs::file_type::regular && it->path().extension() != ".bak") {
+ } else if (it.depth() == 0 && it->symlink_status().type() == fs::file_type::regular) {
if (it->path().filename() == "wallet.dat") {
// Found top-level wallet.dat file, add top level directory ""
```
The test imports a `sh(wsh(pkh()))` output but only calls `getaddressinfo` on the native P2WSH address after migration. Check that the migrated wallet owns both forms and reports the embedded script for each. With this mutation, `getaddressinfo` omits `embedded` for the wrapped address while still returning it for the native address. ```diff diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp index 3470bce..f85951a34f 100644 --- a/src/wallet/rpc/addresses.cpp +++ b/src/wallet/rpc/addresses.cpp @@ -319,5 +319,5 @@ public: UniValue obj(UniValue::VOBJ); CScript subscript; - if (provider && provider->GetCScript(ToScriptID(scripthash), subscript)) { + if (provider && provider->GetCScript(ToScriptID(scripthash), subscript) && !subscript.IsPayToWitnessScriptHash()) { ProcessSubScript(subscript, obj); } ```
cc9a9a8 to
6e765ad
Compare
|
Rebased on #34193, kept its cleanup check, and limited the pre-migration |

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
warningsfield, 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
listwalletdirto 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
getaddressinforeportsismineas true and includes theembeddedfield.Mutation tests: To test each change, apply the mutation in its commit message and run
wallet_migration.py.