fix: loop on mismatched passphrase entry #5396
Merged
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
If the user enters a new or changed passphrase and fails to confirm it, an exit error is immediately returned. This PR updates to prompt the user to try again, up to a sanity limit.
Closes issue 5391.
Motivation and Context
The user is prompted to enter and confirm a new passphrase in two cases: when creating a new wallet, and when changing the passphrase of an existing wallet. In both cases, failure to confirm the new passphrase correctly returns an exit error.
This PR prompts the user again if the new passphrase and its confirmation do not match.
We probably don't want the user to get stuck in an infinite loop and go insane, so there is a sanity limit of three tries. If the user fails this many times, we return the exit error.
How Has This Been Tested?
Tested manually.
What process can a PR reviewer use to test or verify this change?
Test the following scenarios manually: