Skip to content

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

Open
achow101 wants to merge 5 commits into
bitcoin:masterfrom
achow101:rm-erase-txs
Open

achow101 wants to merge 5 commits into
bitcoin:masterfrom
achow101:rm-erase-txs

Conversation

@achow101

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

@DrahtBot

DrahtBot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

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

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
Concept ACK rkrux

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #37055 (refactor: drop format calls on strings without arguments by fanquake)
  • #36767 (wallet: fix crash when external signer wallet creation fails by zerog975)
  • #36167 (build: Enable -Wunused by fanquake)
  • #35998 (wallet: Handle or explicitly ignore WalletBatch write failures by achow101)
  • #35786 (wallet: drop spent parents redundant cache invalidation and notification by furszy)
  • #35302 (Silent Payments: Sending (take 2) by Eunovo)
  • #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 typos and grammar issues:

  • src/wallet/migration.cpp: entires → entries [misspelling]

2026-11-30 20:41:52

@rkrux

rkrux commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Concept ACK - good find, helps in code clean up.

@DrahtBot

Copy link
Copy Markdown
Contributor

🚧 At least one of the CI tasks failed.
Task lint: https://github.com/bitcoin/bitcoin/actions/runs/45491569567/job/138790995980
LLM reason (✨ experimental): CI failed because the lint check assert_falsy found assert(false) in src/wallet/migration.cpp:117; replace it with AssertUnreachable().

Hints

Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

Instead of erasing legacy wallet records and tx records from the
migrated database, skip copying these records in the first place.
Instead copying all of the address book entries and deleting the ones
that are no longer relevant, avoid writing the address book entries in
the first place and write only the ones that are relevant to the
migrated wallets.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants