Repository: bitcoin
Issue: Proposed Timeline for Legacy Wallet and BDB removal
Labels: Feature,Wallet

What to review next: #31378

***

Here is a proposed timeline for the move from legacy wallets to descriptor wallets, and at the same time, bdb to sqlite, culminating with the removal of both legacy wallets and bdb. Even though the wallet type and the wallet storage format are orthogonal to each other, as noted in #19077, I would like to tie them together for the sake of simplicity when it comes to how we make new wallets and the migration of one type to another.

The 4 combinations of type and format are: legacy-bdb, legacy-sqlite, descriptor-bdb, and descriptor-sqlite. While all 4 types will be supported, we will primarily deal with legacy-bdb and descriptor-sqlite. Setting `descriptors=True` in `createwallet` (or checking the Descriptors option in the GUI) will always make a descriptor-sqlite. Setting that to `False` will always make a legacy-bdb.

- [x] 0.21 (late 2020)
  - [x] Initial release of descriptor type and sqlite format. (#16528, #19077)
  - [x] Descriptor type is experimental with a warning as such (#16528)
  - [x] Only legacy-bdb and descriptor-sqlite will be created (#19077)
- [x] 22.0 (mid 2021)
  - [x] Implement descriptor exports (#20226)
  - [x] Legacy type remains default (no pr needed)
  - [x] Introduce `dump` and `createfromdump` wallet tool commands with an additional `-format` option to specify the wallet type (#19137)
    * Users may use `dump` and then `createfromdump` in order to make legacy-sqlite from legacy-bdb
    * Users may use `dump` and then `createfromdump` in order to make descriptor-bdb from descriptor-sqlite
  - [x] If a wallet specified in conf or command line doesn't exist, don't make a wallet and instead warn (#15454)
- [x] 23.0 (early 2022)
  - [x] Change descriptor type to non-experimental (#23002)
  - [x] Change `createwallet` `descriptors` default to `True` (#23002)
  - [x] Change wallet tool `create` `-descriptors` default to `True` (#23002)
- [x] 24.0 (late 2022)
  - [x] Introduce `migratewallet` command to migrate a legacy-bdb to descriptor-sqlite (#19602)
  - [x] For newly created legacy-bdb wallets, warn that they are deprecated and will soon be unsupported (#24505)
- [x] 26.0 (late 2023)
  - [x] When loading legacy-bdb, descriptor-bdb, or legacy-sqlite wallets, warn that the legacy type and bdb format will soon be unsupported, as applicable. (#27869)
  - [x] Deprecate creating new legacy-bdb wallets #28597 
  - [x] `migratewallet` bug fixes
    - [x] #28609
    - [x] #28546
- [x] 27.0 (early 2024)
  - [x] address book performance improvement #26836
  - [x] bulk deletion of txs performance improvement #28987
  - [x] bulk deletion of records performance improvement #29403
  - [x] Caching to improve performance of migrated non-HD descriptor wallets (also perf improvement in general) #26008
  - [x] Remove `migratewallet` experimental warning #28037 
- [x] 28.0 (late 2024)
  - [x] Improve performance of migratewallet #28574
  - [x] Reimplement legacy-bdb to descriptor-sqlite migration (maybe as a separate command or in the wallet tool) to be independent of `LegacyScriptPubKeyMan` and BDB (#26596)
  - [x] For `dump`, implement an independent BDB file loader (this should probably be shared with the previous) (#26606)
  - [x] GUI: Migrate wallets that are not loaded (https://github.com/bitcoin-core/gui/pull/824)
  - [x] Fix default wallet migration naming (#29586)
  - [x] Fix `listwalletdir` of migrated default wallets and generated backups (#30265)
- [ ] 29.0 (early 2025)
  - [x] Watch-only wallet migration edge case (#31374)
  - [ ] Invalid multisigs migration edge case (#31378)
  - [ ] Avoid weird script corner cases (#31495)
  - [x] Rework wallet_migration.py (#31248)
  - [x] Add combinerawtransaction test that doesn't need legacy wallet (#31249)
  - [ ] Remove legacy wallet from migration benchmark (#31241)
  - [ ] Stop loading legacy-bdb, descriptor-bdb, legacy-sqlite wallet entirely. Inform users how to migrate (#31250)
  - [ ] Remove `LegacyScriptPubKeyMan` except for the independent migration stuff (#28710)
  - [ ] Remove BDB except for independent loading for migration stuff (#28710)

Additional improvements that have no target deadline:

- [x] Backwards compatibility tests fixes for descriptor wallets #28027

The migration code will probably be around for a long time/forever.

Note that we expect users who go through the effort to make a legacy-sqlite or descriptor-bdb wallet to suck it up and deal with the consequences of doing something that isn't really supported. Such users should be able to figure out for themselves how to migrate their wallets. (Maybe `migratewallet` can migrate legacy-sqlite to descriptor-sqlite. bdb to sqlite is way easier than legacy to descriptor).