wallet, migration: Skip legacy wallet records rather than erasing them, and drop unused record erase functions #36823

pull achow101 wants to merge 4 commits into bitcoin:master from achow101:rm-erase-txs changing 7 files +17 −153
  1. achow101 commented at 12:10 AM on November 10, 2026: member

    When migrating a legacy wallet, we can skip the records in MigrateToSQLite that we would delete later on during migration. These records are specifically all of the legacy wallet records, and transaction records. The legacy wallet records are replaced with descriptor records produced during migration, and transaction records are already being rewritten by migration, so not writing them in the first place is also fine. This allows us to remove several database record erase functions, specifically EraseTx and EraseRecords.

  2. DrahtBot commented at 12:10 AM on November 10, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36897 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36897.svg"></sub> (wallet, migration: Contain all legacy wallet and migration related things in its own subdirectory, namespace, and classes by achow101)
    • #36825 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36825.svg"></sub> (wallet: fix migration with watch-only transactions by psychemist)
    • #36813 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36813.svg"></sub> (refactor: more prereqs for #36743 by fanquake)
    • #36767 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36767.svg"></sub> (wallet: fix crash when external signer wallet creation fails by zerog975)
    • #36743 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36743.svg"></sub> ([RFC] build: build with -Wmissing-declarations/prototypes by fanquake)
    • #36167 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36167.svg"></sub> (build: Enable -Wunused by fanquake)
    • #35998 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35998.svg"></sub> (wallet: Handle or explicitly ignore WalletBatch write failures by achow101)
    • #35786 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35786.svg"></sub> (wallet: drop spent parents redundant cache invalidation and notification by furszy)
    • #35716 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35716.svg"></sub> (wallet: Replace mapWallet and wtxOrdered with a boost::multi_index by achow101)
    • #35302 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/35302.svg"></sub> (Silent Payments: Sending (take 2) by Eunovo)
    • #34909 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34909.svg"></sub> (wallet, refactor: modularise wallet by extracting out legacy wallet migration by rkrux)
    • #34193 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34193.svg"></sub> (wallet: make migration more robust against failures by furszy)
    • #30343 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/30343.svg"></sub> (wallet, logging: Replace WalletLogPrintf() with LogInfo() by ryanofsky)
    • #27865 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/27865.svg"></sub> (wallet: Track no-longer-spendable TXOs separately by achow101)
    • #26022 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/26022.svg"></sub> (Add util::ResultPtr class by ryanofsky)
    • #25665 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/25665.svg"></sub> (refactor: Add util::Result failure types and ability to merge result values by ryanofsky)

    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.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  3. DrahtBot added the label Needs rebase on Nov 11, 2026
  4. wallet: Skip copy of legacy wallet records rather than erasing
    Instead of erasing legacy wallet records and tx records from the
    migrated database, skip copying these records in the first place.
    a80d7e9d5c
  5. wallet: Remove unused RemoveTxs and EraseTx bd310c0312
  6. wallet, walletdb: Remove unused DeleteRecordsWithDB and EraseRecords f6f0debe07
  7. walletdb: Make HasLegacyRecords static
    HasLegacyRecords is only used by LoadLegacyWalletRecords to check
    whether a descriptor wallet has any legacy wallet records. This does not
    require a CWallet, and is no longer called by anything outside of
    walletdb.cpp.
    fee32caafb
  8. achow101 force-pushed on Nov 12, 2026
  9. DrahtBot removed the label Needs rebase on Nov 12, 2026

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-11-19 19:51 UTC

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