Skip to content

test: check backup from migratewallet can be successfully restored#28257

Merged
fanquake merged 1 commit into
bitcoin:masterfrom
brunoerg:2023-08-test-wallet-migration-restore
Aug 16, 2023
Merged

test: check backup from migratewallet can be successfully restored#28257
fanquake merged 1 commit into
bitcoin:masterfrom
brunoerg:2023-08-test-wallet-migration-restore

Conversation

@brunoerg
Copy link
Copy Markdown
Contributor

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.

@DrahtBot
Copy link
Copy Markdown
Contributor

DrahtBot commented Aug 11, 2023

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

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 DrahtBot added the Tests label Aug 11, 2023
Copy link
Copy Markdown
Member

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 the migratewallet() 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 brunoerg force-pushed the 2023-08-test-wallet-migration-restore branch 2 times, most recently from e96b55c to 8182ea1 Compare August 11, 2023 19:39
@brunoerg brunoerg force-pushed the 2023-08-test-wallet-migration-restore branch from 8182ea1 to 769f5b1 Compare August 11, 2023 19:40
@brunoerg
Copy link
Copy Markdown
Contributor Author

Thanks, @furszy. Initially, I was thinking about identifying all backup files into the node's directory, run migratewallet with 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
Copy link
Copy Markdown
Member

ACK 769f5b1

@fanquake fanquake requested a review from furszy August 16, 2023 09:29
@maflcko
Copy link
Copy Markdown
Member

maflcko commented Aug 16, 2023

lgtm ACK 769f5b1

@fanquake fanquake merged commit 72304cc into bitcoin:master Aug 16, 2023
Copy link
Copy Markdown
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post-merge ACK.

For the getwalletinfo['balance'] check, RPC getbalances['mine']['trusted'] should work as well.

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 17, 2023
…uccessfully restored

769f5b1 test: check backup from `migratewallet` can be successfully restored (brunoerg)

Pull request description:

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

ACKs for top commit:
  achow101:
    ACK 769f5b1
  MarcoFalke:
    lgtm ACK 769f5b1

Tree-SHA512: 94c50b34fbd47c4d3cc34b94e9e7903bc233608c7f50f45c161669996fd5f5b7d8f9a4e6a3437b9151d66a76af833f3f1ca28e44ecb63b5a8f391f6d6be0e39f
@bitcoin bitcoin locked and limited conversation to collaborators Dec 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants