Skip to content

wallet: remove dead code in legacy wallet migration - #32758

Merged
achow101 merged 2 commits into
bitcoin:masterfrom
rkrux:migration-deadcode
Jul 10, 2025
Merged

wallet: remove dead code in legacy wallet migration#32758
achow101 merged 2 commits into
bitcoin:masterfrom
rkrux:migration-deadcode

Conversation

@rkrux

@rkrux rkrux commented Jun 16, 2025

Copy link
Copy Markdown
Contributor

A discussion on a previous PR 32481 related to legacy wallet dead
code removal made me realize that checking if the legacy
wallet was loaded prior to the start of the migration is not
required ever since legacy wallets can't be loaded in the first
place. I also verified that the load_on_start persistent
setting can also not cause the legacy wallets to be loaded, which
further makes the case for removal of the above mentioned checks
during migration.
The current test coverage also shows these lines uncovered.

@DrahtBot

ghost commented Jun 16, 2025

Copy link
Copy Markdown
Contributor

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

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32758.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK furszy, achow101
Stale ACK pablomartin4btc

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #32273 (wallet: Fix relative path backup during migration. by davidgumberg)

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.

@rkrux
rkrux force-pushed the migration-deadcode branch from 38f74e1 to 67845e0 Compare June 16, 2025 09:10
@rkrux rkrux changed the title wallet: wip wallet: remove dead code in legacy wallet migration Jun 16, 2025
@rkrux
rkrux marked this pull request as ready for review June 16, 2025 09:11
@rkrux

ghost commented Jun 16, 2025

Copy link
Copy Markdown
Contributor Author

previous releases, depends DEBUGFailing after 4m — Task Summary

This seems unrelated as the error is 0curl: (6) Could not resolve host: github.com in the CI run.

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK

I've left some comments.

I think now the reload_wallet helper could be moved into the if (success) { condition:
https://github.com/bitcoin/bitcoin/blob/67845e0411241d83c770fafa933b11cf6b8b27b8/src/wallet/wallet.cpp#L4202-L4209

Comment thread src/wallet/wallet.cpp Outdated
Comment thread src/wallet/wallet.cpp Outdated
Comment thread src/wallet/wallet.cpp Outdated
Comment on lines 4211 to 4232

ghost Jun 16, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be removed entirely if MigrateLegacyToDescriptor(std::shared_ptr<CWallet> local_wallet, ... was only called from MigrateLegacyToDescriptor(const std::string& wallet_name, ... but currently this function is also being called from the bench wallet_migration.cpp.

@rkrux
rkrux force-pushed the migration-deadcode branch from 67845e0 to 2bd3a55 Compare June 17, 2025 11:06
@rkrux

ghost commented Jun 17, 2025

Copy link
Copy Markdown
Contributor Author

I think now the reload_wallet helper could be moved into the if (success) { condition:

Makes sense, I have done this. Also, ended up doing few related changes in the subsequent commits.

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-ACK 0635f107c4e1442ce6b953308723b58044c558df

@fanquake
fanquake requested a review from furszy June 24, 2025 15:22

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

I think the second commit would look nicer and simpler after something like e86d71b (which is part of #31423). We’d be able to inline the function at that point.

@rkrux

ghost commented Jun 25, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for highlighting.
I'll take a look at #31423 soon, it had fallen off my radar for some reason.

@achow101

ghost commented Jun 25, 2025

Copy link
Copy Markdown
Member

ACK 0635f107c4e1442ce6b953308723b58044c558df

@DrahtBot
DrahtBot requested a review from furszy June 25, 2025 23:03
A discussion on a previous PR 32481 related to legacy wallet dead
code removal made me realize that checking if the legacy
wallet was loaded prior to the start of the migration is not
required ever since legacy wallets can't be loaded in the first
place. I also verified that the `load_on_start` persistent
setting can also not cause the legacy wallets to be loaded, which
further makes the case for removal of the above mentioned checks
during migration.
The current test coverage also shows these lines uncovered.
@rkrux
rkrux force-pushed the migration-deadcode branch from 0635f10 to b4b28fd Compare July 3, 2025 09:14
@rkrux

ghost commented Jul 3, 2025

Copy link
Copy Markdown
Contributor Author

Rebased over master to incorporate changes from #31423.

Comment thread src/wallet/wallet.cpp Outdated
Comment thread src/wallet/wallet.cpp Outdated
@rkrux
rkrux force-pushed the migration-deadcode branch from 351fd68 to 2b8b658 Compare July 7, 2025 14:58

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code reviewed, looks good. Just left a comment about the last commit.

Comment thread src/wallet/wallet.cpp Outdated
Also, update related comments because a reload is not happening
anymore. It is done because the legacy wallets could not have been
loaded prior to migration, so I don't think a reload is happening
post a successful migration, it's just load IMO.
@rkrux
rkrux force-pushed the migration-deadcode branch from 2b8b658 to 150b5c9 Compare July 8, 2025 10:38

ghost left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 150b5c9

@achow101

ghost commented Jul 10, 2025

Copy link
Copy Markdown
Member

ACK 150b5c9

@achow101
achow101 merged commit 7f28e80 into bitcoin:master Jul 10, 2025
@bitcoin bitcoin locked and limited conversation to collaborators Jul 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants