Skip to content

Conversation

achow101
Copy link
Member

This PR fixes an assertion error that is hit during the setup of the new database during migration of a wallet that was not contained in a wallet dir. Also added a test for this case as well as one for migrating the default wallet.

@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 21, 2022

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 ryanofsky, furszy
Stale ACK aureleoules

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #26836 (wallet: finish addressbook encapsulation and simplify addressbook migration by furszy)

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.

Copy link
Contributor

@aureleoules aureleoules left a comment

Choose a reason for hiding this comment

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

ACK 17ffb12 - LGTM

I cherry-picked the test on master and it indeed crashes.

Copy link
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.

Code review ACK 17ffb12

The assertion error happens when you have the default legacy wallet created (no dir, standalone file), and try to migrate another wallet file that is placed in the same base directory.

As we are using the directory path inside the migration process to create the new database instead of the file path, the code auto-completes the path with the wallet.dat file name; which clashes with the default legacy wallet, which already exist, returning nullptr from the db creation process, crashing at the assertion point.

If there would be no default legacy wallet, the process should work "fine". The only problematic would be the migrated wallet file that would be named "wallet.dat" instead of using the wallet's real filename.

@achow101 achow101 force-pushed the migrate-plain-wallet-file branch from 17ffb12 to 52634db Compare March 1, 2023 13:26
Copy link
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.

rebase ACK 52634db

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK 52634db, but it would be nice if fix could be simplified as suggested.

@bitcoin bitcoin deleted a comment Jun 9, 2023
@achow101 achow101 force-pushed the migrate-plain-wallet-file branch from 52634db to 0a0f293 Compare June 12, 2023 19:13
@achow101 achow101 force-pushed the migrate-plain-wallet-file branch from 0a0f293 to a1e6538 Compare June 12, 2023 19:14
Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

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

Code review ACK a1e6538

Just applied suggested change since last review

@DrahtBot DrahtBot requested a review from furszy June 12, 2023 19:31
Copy link
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.

ACK a1e6538

@ryanofsky ryanofsky merged commit ee22ca5 into bitcoin:master Jun 20, 2023
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jun 21, 2023
… dir

a1e6538 test: Add test for migrating default wallet and plain file wallet (Andrew Chow)
bdbe3fd wallet: Generated migrated wallet's path from walletdir and name (Andrew Chow)

Pull request description:

  This PR fixes an assertion error that is hit during the setup of the new database during migration of a wallet that was not contained in a wallet dir. Also added a test for this case as well as one for migrating the default wallet.

ACKs for top commit:
  ryanofsky:
    Code review ACK a1e6538
  furszy:
    ACK a1e6538

Tree-SHA512: 96b218c0de8567d8650ec96e1bf58b0f8ca4c4726f5efc6362453979b56b9d569baea0bb09befb3a5aed8d16d29bf75ed5cd8ffc432bbd4cbcad3ac5574bc479
@bitcoin bitcoin locked and limited conversation to collaborators Jun 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants