wallet: migrate wallet, exit early if no legacy data exist#26910
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. 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. |
john-moffett
left a comment
There was a problem hiding this comment.
Concept ACK. Tested with and without changes and works as described.
There was a problem hiding this comment.
I wonder if the message is consistent with how the migration code actually works. For instance, the error returned before this change is "This wallet already uses SQLite":
Lines 3765 to 3774 in fbe5e12
Even if it passed that check (which I believe is impossible in this situation), it does the same check as in this PR and reads "This wallet is already a descriptor wallet":
Lines 3837 to 3845 in fbe5e12
Minor additional nit: I think the RPC error messages typically start with a capital letter after the Error: unless it's an RPC command (as in line 745 above).
There was a problem hiding this comment.
I wonder if the message is consistent with how the migration code actually works. For instance, the error returned before this change is "This wallet already uses SQLite"
well, think about the command purpose. If there is no legacy data to migrate then why the command should be executed at all? Doesn't really care if the db is sqlite, bdb or anything else.
Minor additional nit: I think the RPC error messages typically start with a capital letter after the Error: unless it's an RPC command (as in line 745 above).
Seems that we have a mix of them, some errors start with a capital letter, some others not (like the encrypt.cpp file). I'm more aligned to this second form but have no real preference for any. Maybe the best move would be to open an issue an align all of them, in one way or another, at once.
There was a problem hiding this comment.
If there is no legacy data to migrate then why the command should be executed at all?
Right, I agree that the message makes logical sense, though I do worry that it suggests that someone can have a descriptor wallet with legacy data, or they may think that "legacy" addresses are "legacy data", like getnewaddress -addresstype legacy.
My personal preference is to copy the Error: This wallet is already a descriptor wallet message, since that better matches the help migratewallet message: Migrate the wallet to a descriptor wallet.
That said, it's not a strong preference. Maybe @achow101 could weigh in?
There was a problem hiding this comment.
Right, I agree that the message makes logical sense, though I do worry that it suggests that someone can have a descriptor wallet with legacy data
It's theoretically possible to have a descriptor wallet using BDB for the database as well as a legacy wallet using sqlite. These are unsupported configurations, but are allowed and possible to achieve using the wallettool. That being said, they are unsupported so I think it's fine, and the number of people who would have such wallets should be limited to a very small number of developers.
Regarding the error message, I would also prefer the "already a descriptor wallet" wording.
There was a problem hiding this comment.
pushed.
Moved the GetDescriptorsForLegacy error up to the top of the process to not duplicate it.
otherwise the process will create a backup file then return an error when notices that the db is already running sqlite.
412a9aa to
6d31900
Compare
|
ACK 6d31900 Tested and code review. |
|
ACK 6d31900 |
…data exist 6d31900 wallet: migrate wallet, exit early if no legacy data exist (furszy) Pull request description: The process first creates a backup file then return an error, without removing the recently created file, when notices that the db is already running sqlite. ACKs for top commit: john-moffett: ACK 6d31900 achow101: ACK 6d31900 ishaanam: crACK 6d31900 Tree-SHA512: 9fb52e80de96e129487ab91bef13647bc4570a782003b1e37940e2a00ca26283fd24ad39bdb63a984ae0a56140b518fd0d74aa2fc59ab04405b2c179b7d3c54a
The process first creates a backup file then return an error,
without removing the recently created file, when notices that
the db is already running sqlite.