This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
[RCD-47] Fix 'hasSpendingPassword' metadata recovery during migration #3876
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When I create a wallet without a password on the 1.3.1 build and then upgrade\migrate to 2.0.0; the resulting wallet has a spending password enforced.
When migrating from an old data-layer, we don't have much information about whether there was a password defined on a wallet. So, we use to apply some heuristic based on the password last upate timestamp.
This is rather unreliable and can return misleading metadata for wallets which don't have passwords. Because there's no such thing as "no password" (secret keys are actually encrypted with an empty passphrase), it is possible to assess whether a key was encrypted with a password by trying to decrypt with an empty one. If it succeeds, then we can tell for sure that there's no password defined for the given key.
Linked issue
RCD-47
Type of change
Developer checklist
Testing checklist
QA Steps
hasSpendingPassword
metadata attributeScreenshots (if available)
How to merge
Send the message
bors r+
to merge this PR. For more information, seedocs/how-to/bors.md
.