mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 15:11:38 +00:00
WIP: wallet, migration: Contain all legacy wallet and migration related things in its own subdirectory, namespace, and classes #36897
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!36897
Loading…
Reference in a new issue
No description provided.
Delete branch "contain-wallet-migration"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally, legacy wallet migration was built upon the foundation of being able to load legacy wallets. Now that we no longer support loading legacy wallets, there is no reason to keep any of the legacy wallet loading and migration code in the main wallet objects. Having this co-mingling of never-to-be-changed legacy wallet code and new descriptor wallet code makes it difficult to implement new things into the wallet.
This PR fully separates out all of the legacy wallet related things into a subdirectory
wallet/legacy, with everything in that directory under awallet::legacy_migrationnamespace so as to prevent accidental usage outside of legacy wallets. This includes a little bit of duplication with current loading code, but not that much, and we are able to both remove unrelated descriptor wallet loading from the legacy wallet loading, and unrelated legacy wallet loading from normal descriptor wallet loading.LegacyWalletis introduced as a subclass ofCWalletwhich contains all of the relevant legacy wallet and migration functions so thatCWalletcannot accidentally use some legacy wallet function. Additionally,LegacyDataSPKMis moved into a new file and this new namespace so that it cannot be used outside of migration.Lastly,
ReorderTransactionsis a legacy wallet only function that is also moved intoLegacyWallet.Builds upon #34909, and depends on #36823 for removing some functions that were previously used by migration.
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.
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:
src/and treat them as errors by hebasto)-Wunusedby fanquake)WalletBatchwrite failures 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/legacy/migration.cpp:entires→entries[misspelling]src/wallet/walletdb.cpp:descriptor walletsv→descriptor wallets[misspelling]Possible places where named args for integral literals may be used (e.g.
func(x, /*named_arg=*/0)in C++, andfunc(x, named_arg=0)in Python):src/wallet/legacy/spkm.cpp:WalletDescriptor w_desc(std::move(descs.at(0)), creation_time, 0, 0, 0)— for the non-HD key descriptorsrc/wallet/legacy/spkm.cpp:WalletDescriptor w_desc(std::move(descs.at(0)), 0, 0, chain_counter, 0)src/wallet/legacy/spkm.cpp:Parse(desc_str, provider, error, false)src/wallet/legacy/spkm.cpp:WalletDescriptor w_desc(std::move(desc), creation_time, 0, 0, 0)— for the inferred descriptorsrc/wallet/legacy/spkm.cpp:Parse(desc_str, parsed_keys, parse_error, false)2026-11-30 23:04:02
🚧 At least one of the CI tasks failed.
Task
macOS-cross to x86_64: https://github.com/bitcoin/bitcoin/actions/runs/43977159977/job/133683977345LLM reason (✨ experimental): The build failed because
legacy/load.cppcapturesbatchin a lambda without using it, and Clang treats the warning as an error.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.
6 additional verified findings in the Review report.
Earlier concerns neither republished nor resolved: 2 minor findings · 1 suggestion. See the Run archive linked from the Review report for their assessments.
🔴 Major · Migration silently drops contacts from legacy wallets without key or script records
A blank legacy wallet containing sending-address labels can migrate successfully with its entire address book missing from the reloaded wallet.
Location:
src/wallet/legacy/migration.cpp:131(head).🟠 Minor · Descriptor loading rejects transaction order information it previously repaired
A descriptor wallet retaining
nOrderPos == -1after an older migration now fails to load rather than being repaired; the affected release range is unestablished.Location:
src/wallet/walletdb.cpp:712(head).🟠 Minor ·
spkm_migrationreaches a null-chain assertion during setupSource inspection shows that every fuzz input reaches the null-chain assertion before exercising migration.
Location:
src/wallet/test/fuzz/scriptpubkeyman.cpp:226(head).🟠 Minor · Legacy header guard comments fail the include-guard lint
Source inspection establishes that both new legacy headers fail the exact closing-guard check in
lint-include-guards.py; no lint execution was recorded.Location:
src/wallet/legacy/bdbro.h:112(head).🟠 Minor · Migration ignores
-keypoolwhen generating active descriptorsFor spendable legacy wallets, a small non-default
-keypoolno longer limits migration's initial descriptor derivation, increasing work and the persisted range.Location:
src/wallet/legacy/load.cpp:643(head).🟠 Minor · Retained transaction writes can fail without failing migration
An ignored
WriteTxMetadatafailure can omit a main-wallet transaction if the surrounding transaction still commits, because migration no longer copies rawTXrecords.Location:
src/wallet/legacy/migration.cpp:411(head).Reviewed:
af54bd9bf1b1· Review report · Previous reportspermalink
🐙 This pull request conflicts with the target branch and needs rebase.
Thanks for building over #34909, strong Concept ACK.
🐙 This pull request conflicts with the target branch and needs rebase.
🐙 This pull request conflicts with the target branch and needs rebase.