migratewallet migrates the wallet to a descriptor one. During the process, it generates a backup file of the wallet in case of an incorrect migration. This PR adds test to check if the backup file can be successfully restored.
test: check backup from `migratewallet` can be successfully restored #28257
pull brunoerg wants to merge 1 commits into bitcoin:master from brunoerg:2023-08-test-wallet-migration-restore changing 1 files +10 −1-
brunoerg commented at 12:46 PM on August 11, 2023: contributor
-
DrahtBot commented at 12:46 PM on August 11, 2023: contributor
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--021abf342d371248e50ceaed478a90ca-->
Reviews
See the guideline for information on the review process.
Type Reviewers ACK achow101, MarcoFalke Concept ACK furszy If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
- DrahtBot added the label Tests on Aug 11, 2023
-
furszy commented at 1:53 PM on August 11, 2023: member
While I'm a concept ACK, I think that the approach isn't the best.
The code is walking through the node's directory, restoring all the backup files without checking if the restored wallet is correct or not.
The main point behind a backup test should be to assert that the restored wallet has the same balance and it watches the same scripts as before. Not only check that the backup file can be opened (the wallet could be empty or missing some information).
Also, test cases should be independent from each other.
Would suggest to test this inside the main
test_basic()case. Using themigratewallet()return information to access the backup path (the command retrieves the backup path). And check that balance and watched scripts are the same prior and post migration. - brunoerg force-pushed on Aug 11, 2023
- brunoerg force-pushed on Aug 11, 2023
-
test: check backup from `migratewallet` can be successfully restored 769f5b15f2
- brunoerg force-pushed on Aug 11, 2023
-
brunoerg commented at 7:48 PM on August 11, 2023: contributor
Thanks, @furszy. Initially, I was thinking about identifying all backup files into the node's directory, run
migratewalletwith them and check the result. However, I agree it's better to go beyond by checking wallet's balance and other stuff prior and post migration.Force-pushed changing the approach. I also moved it to
test_basic(). -
achow101 commented at 7:31 PM on August 15, 2023: member
ACK 769f5b15f207ce6d1067672ea5e195541c97de6b
- fanquake requested review from furszy on Aug 16, 2023
-
maflcko commented at 10:30 AM on August 16, 2023: member
lgtm ACK 769f5b15f207ce6d1067672ea5e195541c97de6b
- fanquake merged this on Aug 16, 2023
- fanquake closed this on Aug 16, 2023
-
jonatack commented at 8:27 PM on August 16, 2023: member
Post-merge ACK.
For the getwalletinfo['balance'] check, RPC getbalances['mine']['trusted'] should work as well.
- sidhujag referenced this in commit 11f6aa775b on Aug 17, 2023
- bitcoin locked this on Dec 5, 2024