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

bitcoin/bitcoin: PR #34909

3 suggestions

Optional improvements

Link

[suggestion] · walletutil.h unnecessarily exposes the full chain interface

The reference-only settings declarations make walletutil.h consumers inherit interfaces/chain.h; a forward declaration would avoid that dependency, although compile-time savings are unmeasured.

Location: src/wallet/walletutil.h:8 (head).

Details and suggested fix

The three settings helpers take interfaces::Chain&, and no inline code in walletutil.h needs its definition. Nevertheless, the new include propagates the chain interface and dependencies such as blockfilter.h and kernel/chain.h through consumers including walletdb.h. Forward-declare namespace interfaces { class Chain; } in the header and include interfaces/chain.h in walletutil.cpp, where the member calls occur. Supply the declaration dependencies directly with util/result.h, <optional>, and a declaration of bilingual_str. This preserves the API and behavior; consumers that already include the chain interface independently will not benefit.


Link

[suggestion] · migration.cpp and migration.h omit the moved code's license headers

The extracted files omit the copyright and MIT notices from wallet.cpp and wallet.h, contrary to the attribution requirement in CONTRIBUTING.md.

Location: src/wallet/migration.cpp:1 (head).

Details and suggested fix

migration.cpp starts with an include and migration.h starts with its include guard, so neither retains the notices accompanying the extracted code. Both original files carry the Satoshi Nakamoto and Bitcoin Core copyright lines followed by the MIT notice. Copy those headers into both new files to preserve the attribution required by CONTRIBUTING.md.


Link

[suggestion] · GetWalletPath documentation is restored in an unrelated commit

The utility extraction drops the GetWalletPath comment, leaving the following migration-API extraction with an unrelated documentation-only change to walletutil.h.

Location: src/wallet/walletutil.h:85 at 156249d75e0f (commit) (commit).

Details and suggested fix

Commit 156249d75e0f9342015dc114fe1cf2210325d094, which extracts the utility functions, moves the declaration without its comment. Its direct parent, 5c8b0872b62a35d33461bb6d4c9b306a562b1f63, still has the comment in wallet.h. Commit e8165d533191e42ab4f8dd52e9233e13ff8f1262, which extracts the migration API, then changes walletutil.h solely to restore it. Carry the comment with the declaration in 156249d75e0f9342015dc114fe1cf2210325d094 and remove the restoration hunk from e8165d533191e42ab4f8dd52e9233e13ff8f1262. This keeps the extraction self-contained and avoids an unrelated file change when reviewing the next commit, without changing the final tree.


Coverage details