wallet, refactor: modularise wallet by extracting out legacy wallet migration #34909

pull rkrux wants to merge 1 commits into bitcoin:master from rkrux:wallet-migration changing 11 files +816 −783
  1. rkrux commented at 1:00 pm on March 24, 2026: contributor

    I’ve been meaning to scratch this itch for quite some time. It has been noted by many developers that the wallet/wallet.cpp file is quite hard to reason about.

    It is more than 4500 lines long currently and this patch is an attempt to shortern it by around 780 lines by extracting out the wallet migration code into a dedicated wallet/migration.cpp file.

    The other benefits of this PR I see are that it moves the legacy wallet stuff from the main wallet file that paves the way for it being descriptor specific (as much as possible), and makes legacy wallet migration code a first-class citizen in its own file.

    I hope it makes it easier for everyone to go through the main wallet file.

  2. DrahtBot commented at 1:01 pm on March 24, 2026: contributor

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

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34910 (wallet, refactor: rename file from migrate to legacybdb by rkrux)
    • #34806 (refactor: logging: Various API improvements by ajtowns)
    • #34603 (wallet: Fix detection of symlinks on Windows by achow101)
    • #34544 (wallet: Disallow wallet names that are paths including .. and . elements by achow101)
    • #34490 (wallet: Follow-ups to create/load split (#32636) by davidgumberg)
    • #34198 (wallet: fix ancient wallets migration by furszy)
    • #34193 (wallet: make migration more robust against failures by furszy)
    • #33034 (wallet: Store transactions in a separate sqlite table by achow101)
    • #33032 (wallet, test: Replace MockableDatabase with in-memory SQLiteDatabase by achow101)
    • #32895 (wallet: Prepare for future upgrades by recording versions of last client to open and decrypt by achow101)
    • #27865 (wallet: Track no-longer-spendable TXOs separately by achow101)

    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.

    LLM Linter (✨ experimental)

    Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

    • WalletDescriptor(std::move(descs.at(0)), creation_time, 0, 0, 0) in src/wallet/migration.cpp
    • WalletDescriptor(std::move(descs.at(0)), creation_time, 0, 0, 0) in src/wallet/migration.cpp

    2026-03-25 11:32:55

  3. rkrux force-pushed on Mar 24, 2026
  4. DrahtBot added the label CI failed on Mar 24, 2026
  5. rkrux force-pushed on Mar 24, 2026
  6. rkrux commented at 1:12 pm on March 24, 2026: contributor

    Fixed two things:

    • the linter issue where the trailing new line at the end of the file was missing.
    • forgot to update the migration portion in bench for which I didn’t get an error in local, checking why.
  7. DrahtBot removed the label CI failed on Mar 24, 2026
  8. rkrux force-pushed on Mar 25, 2026
  9. rkrux renamed this:
    wallet, refactor: extract migration portion from the wallet file
    wallet, refactor: modularise wallet by extracting out legacy wallet migration
    on Mar 25, 2026
  10. DrahtBot renamed this:
    wallet, refactor: modularise wallet by extracting out legacy wallet migration
    wallet, refactor: modularise wallet by extracting out legacy wallet migration
    on Mar 25, 2026
  11. wallet, refactor: modularise wallet by extracting out legacy wallet migration
    I've been meaning to scratch this itch for quite some time. It has been noted
    by many developers that the `wallet/wallet.cpp` file is quite hard to reason
    about.
    
    It is more than 4500 lines long currently and this patch is an attempt to
    shortern it by around 780 lines by extracting out the wallet migration code into
    a dedicated `wallet/migration.cpp` file.
    
    The other benefits of this PR I see are that it moves the legacy wallet stuff
    from the main wallet file that paves the way for it being descriptor specific
    (as much as possible), and makes legacy wallet migration code a first-class
    citizen in its own file.
    
    I hope it makes it easier for everyone to go through the main wallet file.
    8723a4f06d
  12. rkrux commented at 11:24 am on March 25, 2026: contributor
    Pushed an update where three more migration specific CWallet methods are extracted out.
  13. rkrux force-pushed on Mar 25, 2026
  14. DrahtBot added the label CI failed on Mar 25, 2026
  15. DrahtBot removed the label CI failed on Mar 25, 2026


rkrux DrahtBot


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-03-31 12:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me