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

pull rkrux wants to merge 5 commits into bitcoin:master from rkrux:wallet-migration changing 16 files +869 −837
  1. rkrux commented at 1:00 PM on March 24, 2026: contributor

    I've been meaning to scratch this itch for quite some time. It has been noted by many developers that the wallet/wallet.cpp file is quite hard to reason about.

    It is more than 4500 lines long currently and this patch is an attempt to shortern it by around 800 lines by extracting out the wallet migration code into a dedicated wallet/migration.cpp file.

    The other benefits of this PR I see are that it moves the legacy wallet stuff from the main wallet file that paves the way for it being descriptor specific (as much as possible), and makes legacy wallet migration code a first-class citizen in its own file.

    I hope it makes it easier for everyone to go through the main wallet file.

    This patchset should be reviewed with --color-moved=dimmed-zebra option.

  2. DrahtBot commented at 1:01 PM on March 24, 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.

    Type Reviewers
    ACK achow101
    Concept ACK pablomartin4btc, w0xlt

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

    <!--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)
    • #36823 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36823.svg"></sub> (wallet, migration: Skip legacy wallet records rather than erasing them, and drop unused record erase functions by achow101)
    • #36743 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36743.svg"></sub> ([RFC] build: build with -Wmissing-declarations/prototypes by fanquake)
    • #36444 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36444.svg"></sub> (wallet: Store information about created and imported multipath descriptors by achow101)
    • #36443 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36443.svg"></sub> (descriptor: Reconstruct a multipath descriptor from its expansion by achow101)
    • #36442 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36442.svg"></sub> (descriptor: Represent multipath descriptors in a single Descriptor object by achow101)
    • #36268 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36268.svg"></sub> (refactor: prune unused semi-colons 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)
    • #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)
    • #34603 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/34603.svg"></sub> (wallet: Fix detection of symlinks on Windows by achow101)
    • #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-->

    LLM Linter (✨ experimental)

    Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

    • src/wallet/migration.cpp: WalletDescriptor w_desc(std::move(descs.at(0)), creation_time, 0, 0, 0)
    • src/wallet/migration.cpp: AddWalletDescriptor(w_desc, keys, "", false) (both occurrences)

    <sup>2026-10-23 05:57:34</sup>

  3. rkrux force-pushed on Mar 24, 2026
  4. DrahtBot added the label CI failed on Mar 24, 2026
  5. rkrux force-pushed on Mar 24, 2026
  6. rkrux commented at 1:12 PM on March 24, 2026: contributor

    Fixed two things:

    • the linter issue where the trailing new line at the end of the file was missing.
    • forgot to update the migration portion in bench for which I didn't get an error in local, checking why.
  7. DrahtBot removed the label CI failed on Mar 24, 2026
  8. rkrux force-pushed on Mar 25, 2026
  9. rkrux renamed this:
    wallet, refactor: extract migration portion from the wallet file
    wallet, refactor: modularise wallet by extracting out legacy wallet migration
    on Mar 25, 2026
  10. DrahtBot renamed this:
    wallet, refactor: modularise wallet by extracting out legacy wallet migration
    wallet, refactor: modularise wallet by extracting out legacy wallet migration
    on Mar 25, 2026
  11. rkrux commented at 11:24 AM on March 25, 2026: contributor

    Pushed an update where three more migration specific CWallet methods are extracted out.

  12. rkrux force-pushed on Mar 25, 2026
  13. DrahtBot added the label CI failed on Mar 25, 2026
  14. DrahtBot removed the label CI failed on Mar 25, 2026
  15. DrahtBot added the label Needs rebase on Apr 19, 2026
  16. rkrux force-pushed on Apr 22, 2026
  17. rkrux commented at 2:21 PM on April 22, 2026: contributor

    Rebased over master from 8723a4f to ecaef3d.

  18. rkrux force-pushed on Apr 22, 2026
  19. DrahtBot added the label CI failed on Apr 22, 2026
  20. DrahtBot commented at 2:47 PM on April 22, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task Windows native, fuzz, VS: https://github.com/bitcoin/bitcoin/actions/runs/24783607828/job/72521322210</sub> <sub>LLM reason (✨ experimental): CI failed because the spkm_migration fuzz target hit a wallet database format assertion (m_database->Format() != "bdb_ro" && != "mock") in wallet::CWallet::SetupLegacyScriptPubKeyMan and exited with code 1.</sub>

    <details><summary>Hints</summary>

    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.

    </details>

  21. rkrux commented at 2:48 PM on April 22, 2026: contributor

    Force pushed to fix the CI failures because of incorrectly resolving conflicts during rebase due to the changes in this file of this PR.

  22. DrahtBot removed the label Needs rebase on Apr 23, 2026
  23. DrahtBot removed the label CI failed on Apr 23, 2026
  24. rkrux force-pushed on Apr 23, 2026
  25. rkrux commented at 9:43 AM on April 23, 2026: contributor

    Split the diff into multiple commits to aid review from 7b87334 to e9f50db.

  26. rkrux force-pushed on Apr 23, 2026
  27. DrahtBot added the label CI failed on Apr 23, 2026
  28. DrahtBot commented at 9:52 AM on April 23, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task lint: https://github.com/bitcoin/bitcoin/actions/runs/24828329553/job/72670043902</sub> <sub>LLM reason (✨ experimental): CI failed because the trailing_newline lint check reported a missing trailing newline in src/wallet/migration.h.</sub>

    <details><summary>Hints</summary>

    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.

    </details>

  29. rkrux commented at 9:52 AM on April 23, 2026: contributor

    Fixed lint failure due to missing new line in wallet/migration.h.

  30. DrahtBot removed the label CI failed on Apr 23, 2026
  31. DrahtBot added the label Needs rebase on May 2, 2026
  32. rkrux force-pushed on May 5, 2026
  33. rkrux commented at 9:24 AM on May 5, 2026: contributor

    Rebased over master to incorporate changes from #34544.

  34. DrahtBot removed the label Needs rebase on May 5, 2026
  35. DrahtBot added the label Needs rebase on May 22, 2026
  36. rkrux force-pushed on May 22, 2026
  37. rkrux commented at 9:50 AM on May 22, 2026: contributor

    Rebased over master to incorporate changes from #34806.

  38. DrahtBot added the label CI failed on May 22, 2026
  39. fanquake commented at 10:34 AM on May 22, 2026: member
     Build FAILED.
    
    "D:\a\bitcoin\bitcoin\build\ALL_BUILD.vcxproj" (default target) (1) ->
    "D:\a\bitcoin\bitcoin\build\src\bench\bench_bitcoin.vcxproj" (default target) (4) ->
    "D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj" (default target) (12) ->
    (ClCompile target) -> 
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(78,14): error C2027: use of undefined type 'UniValue' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(78,39): error C2027: use of undefined type 'UniValue' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(79,34): error C2027: use of undefined type 'UniValue' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(79,26): error C2530: 'value': references must be initialized [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(79,26): error C3531: 'value': a symbol whose type contains 'auto' must have an initializer [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(79,32): error C2143: syntax error: missing ';' before ':' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(79,59): error C2143: syntax error: missing ';' before ')' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(82,9): error C2027: use of undefined type 'UniValue' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(91,14): error C2027: use of undefined type 'UniValue' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(92,64): error C2027: use of undefined type 'UniValue' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(92,31): error C2079: 'new_value' uses undefined class 'UniValue' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(92,64): error C2065: 'VARR': undeclared identifier [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(93,34): error C2027: use of undefined type 'UniValue' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(93,26): error C2530: 'value': references must be initialized [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(93,26): error C3531: 'value': a symbol whose type contains 'auto' must have an initializer [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(93,32): error C2143: syntax error: missing ';' before ':' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(93,59): error C2143: syntax error: missing ';' before ')' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(96,33): error C2027: use of undefined type 'UniValue' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
      D:\a\bitcoin\bitcoin\src\wallet\walletutil.cpp(97,23): error C2582: 'operator =' function is unavailable in 'UniValue' [D:\a\bitcoin\bitcoin\build\src\wallet\bitcoin_wallet.vcxproj]
    
  40. DrahtBot removed the label Needs rebase on May 22, 2026
  41. rkrux force-pushed on May 22, 2026
  42. DrahtBot removed the label CI failed on May 22, 2026
  43. DrahtBot added the label Needs rebase on May 28, 2026
  44. rkrux force-pushed on May 29, 2026
  45. rkrux commented at 11:15 AM on May 29, 2026: contributor

    Rebased over master to incorporate changes from #28333.

  46. DrahtBot removed the label Needs rebase on May 29, 2026
  47. pablomartin4btc commented at 9:17 PM on June 13, 2026: member

    Concept ACK

    I see you opened also #34910, wouldn't it make sense to add that commit here?

    As a future consideration, have you thought about whether this structure could accommodate future migration types beyond legacy-to-descriptor, perhaps with a dedicated migration class? Curious if that's something worth exploring as a follow-up.

  48. rkrux commented at 9:29 AM on June 15, 2026: contributor

    I see you opened also #34910, wouldn't it make sense to add that commit here?

    I had raised it separately because that change in itself seemed fine as well and I didn't want the changes of this PR to hold merging that PR. But given that #34910 has not been merged yet, I have cherry-picked that commit here and closed that PR now in favour of this one.

  49. rkrux commented at 9:38 AM on June 15, 2026: contributor

    As a future consideration, have you thought about whether this structure could accommodate future migration types beyond legacy-to-descriptor, perhaps with a dedicated migration class? Curious if that's something worth exploring as a follow-up.

    I believe the migration is more of a one-off event and the likelihood of adding other migration flows beyond legacy-to-descriptor is very low, so I don't think it's worth introducing a dedicated migration class at this stage.

  50. DrahtBot added the label Needs rebase on Jun 15, 2026
  51. rkrux force-pushed on Jun 15, 2026
  52. rkrux commented at 2:45 PM on June 15, 2026: contributor

    Rebased over master to incorporate changes from #35414.

  53. DrahtBot added the label CI failed on Jun 15, 2026
  54. DrahtBot commented at 4:41 PM on June 15, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task iwyu: https://github.com/bitcoin/bitcoin/actions/runs/27554400650/job/81454235475</sub> <sub>LLM reason (✨ experimental): CI failed because IWYU reported a failure (“Failure generated from IWYU”) due to incorrect/missing #include ordering/content in src/bench/pool.cpp.</sub>

    <details><summary>Hints</summary>

    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.

    </details>

  55. DrahtBot removed the label Needs rebase on Jun 15, 2026
  56. rkrux commented at 7:00 AM on June 16, 2026: contributor

    The CI / iwyu (pull_request) failure is unrelated and should have been fixed post #35535.

  57. DrahtBot removed the label CI failed on Jun 16, 2026
  58. DrahtBot added the label Needs rebase on Jun 24, 2026
  59. rkrux force-pushed on Jun 25, 2026
  60. rkrux commented at 9:28 AM on June 25, 2026: contributor

    Rebased over master to incorporate changes from PR #35266.

  61. rkrux force-pushed on Jun 25, 2026
  62. DrahtBot added the label CI failed on Jun 25, 2026
  63. rkrux commented at 9:32 AM on June 25, 2026: contributor

    Force-pushed to emphasise in the commit messages that most of the commits should be reviewed with the --color-moved=dimmed-zebra git option.

  64. DrahtBot removed the label Needs rebase on Jun 25, 2026
  65. DrahtBot removed the label CI failed on Jun 25, 2026
  66. DrahtBot added the label Needs rebase on Jul 3, 2026
  67. rkrux force-pushed on Jul 7, 2026
  68. rkrux commented at 12:38 PM on July 7, 2026: contributor

    Rebased over master to incorporate changes from #32489.

  69. DrahtBot removed the label Needs rebase on Jul 7, 2026
  70. DrahtBot added the label Needs rebase on Aug 4, 2026
  71. rkrux force-pushed on Aug 11, 2026
  72. rkrux commented at 10:11 AM on August 11, 2026: contributor

    Rebased over master to incorporate changes from #35501.

  73. DrahtBot removed the label Needs rebase on Aug 11, 2026
  74. DrahtBot added the label Needs rebase on Aug 18, 2026
  75. rkrux force-pushed on Sep 2, 2026
  76. rkrux commented at 10:34 AM on September 2, 2026: contributor

    Rebased over master to fix conflicts.

  77. DrahtBot removed the label Needs rebase on Sep 2, 2026
  78. DrahtBot added the label Needs rebase on Sep 12, 2026
  79. rkrux force-pushed on Sep 12, 2026
  80. rkrux commented at 12:23 PM on September 12, 2026: contributor

    Rebased over master to incorporate changes from #35935.

  81. DrahtBot removed the label Needs rebase on Sep 12, 2026
  82. DrahtBot added the label Needs rebase on Sep 14, 2026
  83. rkrux force-pushed on Sep 14, 2026
  84. rkrux commented at 2:06 PM on September 14, 2026: contributor

    Rebased over master to incorporate changes from #35436 and #34681.

  85. DrahtBot removed the label Needs rebase on Sep 14, 2026
  86. DrahtBot added the label Needs rebase on Sep 22, 2026
  87. rkrux force-pushed on Sep 28, 2026
  88. rkrux commented at 11:46 AM on September 28, 2026: contributor

    Rebased over master to incorporate changes from #35752.

  89. DrahtBot removed the label Needs rebase on Sep 28, 2026
  90. DrahtBot added the label Needs rebase on Oct 5, 2026
  91. rkrux force-pushed on Oct 6, 2026
  92. rkrux commented at 2:05 PM on October 6, 2026: contributor

    Rebased over master to incorporate changes from #32895.

  93. DrahtBot removed the label Needs rebase on Oct 6, 2026
  94. w0xlt commented at 6:05 PM on October 8, 2026: contributor

    Concept ACK

  95. DrahtBot added the label Needs rebase on Oct 20, 2026
  96. wallet: (move-only) extract out migration specific CWallet methods
    From wallet/wallet.cpp to wallet/migration.cpp.
    
    This patch should be reviewed with --color-moved=dimmed-zebra option.
    adfcde180e
  97. wallet: extract out utility functions from wallet/wallet
    To wallet/walletutil.h
    
    Couple of functions had to be made non-static for them to be used by
    wallet/wallet.
    
    This patch should be reviewed with --color-moved=dimmed-zebra option.
    f92202584e
  98. wallet: extract out public facing MigrateLegacyToDescriptor functions
    To wallet/migration. Also, update the includes in the call sites.
    
    This patch should be reviewed with --color-moved=dimmed-zebra.
    ef51d63f87
  99. wallet: extract out migration specific LegacySPKM CWallet methods
    to wallet/migration.
    
    This patch should be reviewed with --color-moved=dimmed-zebra.
    ea578439cb
  100. wallet, refactor: rename file from migrate to legacybdb
    The wallet/migrate.h|cpp file contain all the code related to the
    Berkeley DB that was used in the legacy wallets. Although it's true
    that this code is used only within the context of wallet migration
    but the name of the file is not exact.
    
    This patch renames the file to legacybdb so that the intent is clearer in the
    call sites. I felt this rename might be necessary so that the name
    doesn't conflict with the new migration.cpp introduced in the preceding commits.
    60136a68ba
  101. rkrux force-pushed on Oct 23, 2026
  102. rkrux commented at 5:59 AM on October 23, 2026: contributor

    Rebased over master to incorporate changes from #36397.

  103. DrahtBot removed the label Needs rebase on Oct 23, 2026
  104. in src/wallet/migration.cpp:17 in adfcde180e
      12 | +    auto it = m_internal_spk_managers.find(OutputType::LEGACY);
      13 | +    if (it == m_internal_spk_managers.end()) return nullptr;
      14 | +    return dynamic_cast<LegacyDataSPKM*>(it->second);
      15 | +}
      16 | +
      17 | +bool CWallet::MigrateToSQLite(bilingual_str& error)
    


    achow101 commented at 9:41 PM on November 10, 2026:

    In adfcde180e5ba66c9390e63fd916efd6e07935c1 "wallet: (move-only) extract out migration specific CWallet methods"

    Could these functions be made non-members of CWallet? I don't really like having the implementation of member functions be spread across multiple files.


    rkrux commented at 1:45 PM on November 11, 2026:

    Yes, I did think of this initially but didn't do to keep the scope minimal, but will make them non-members of CWallet now.

  105. achow101 commented at 9:43 PM on November 10, 2026: member

    I think it would be better if we could put all of the legacy wallet migration stuff into its own subdirectory, e.g. src/wallet/legacy/ rather than having the multiple migration related files in the main wallet module directory. This would let us separate out all of the migration things without polluting the main module with these files, especially as there are more things that can be pulled out (in future PRs) from database things.

  106. achow101 commented at 11:15 PM on November 16, 2026: member

    ACK 60136a68baddf49c49ebd79b364ea8857f5d5db9

    I've opened #36897 to implement the suggestions I made earlier, along with additional encapsulation.

  107. DrahtBot requested review from pablomartin4btc on Nov 16, 2026
  108. in src/wallet/wallet.h:1117 in ef51d63f87
    1112 | -[[nodiscard]] util::Result<MigrationResult> MigrateLegacyToDescriptor(const std::string& wallet_name, const SecureString& passphrase, WalletContext& context, bool load_wallet = true);
    1113 | -//! Requirement: The wallet provided to this function must be isolated, with no attachment to the node's context.
    1114 | -[[nodiscard]] util::Result<MigrationResult> MigrateLegacyToDescriptor(std::shared_ptr<CWallet> local_wallet, const SecureString& passphrase, WalletContext& context, bool load_wallet = true);
    1115 | -
    1116 | -//! Determine the path that the wallet is stored in
    1117 | -util::Result<fs::path> GetWalletPath(const std::string& name);
    


    achow101 commented at 1:40 AM on November 17, 2026:

    In f92202584e09f0acfa5e1213817b3987c3e90f96 "wallet: extract out utility functions from wallet/wallet"

    This should be in the previous commit, surprised that CI is passing as the previous commit does not compile.


    rkrux commented at 10:33 AM on November 17, 2026:

    Will be able to check this after couple days.


    fanquake commented at 10:57 AM on November 17, 2026:

    as the previous commit does not compile.

    What failure are you seeing? adfcde180e5ba66c9390e63fd916efd6e07935c1 seems to compile fine for me locally.

    surprised that CI is passing

    cc @maflcko


    maflcko commented at 1:29 PM on November 17, 2026:

    I think it compiles, because the decl exists twice?

    git grep GetWalletPath f922025 -- '*.h'
    f922025:src/wallet/wallet.h:util::Result<fs::path> GetWalletPath(const std::string& name);
    f922025:src/wallet/walletutil.h:util::Result<fs::path> GetWalletPath(const std::string& name);
    

    for me it compiles:

    ./build/bin/bitcoin-wallet -version |grep adfcde180e5b
    Bitcoin Core bitcoin-wallet utility version v32.99.0-adfcde180e5b
    

    achow101 commented at 6:02 PM on November 17, 2026:

    What failure are you seeing? adfcde1 seems to compile fine for me locally.

    In file included from ../../src/wallet/init.cpp:22:
    ../../src/wallet/wallet.h:1117:24: error: redundant redeclaration of ‘util::Result<fs::path> wallet::GetWalletPath(const std::string&)’ in same scope [-Werror=redundant-decls]
     1117 | util::Result<fs::path> GetWalletPath(const std::string& name);
          |                        ^~~~~~~~~~~~~
    In file included from ../../src/wallet/walletdb.h:14,
                     from ../../src/wallet/scriptpubkeyman.h:25,
                     from ../../src/wallet/wallet.h:38:
    ../../src/wallet/walletutil.h:85:24: note: previous declaration of ‘util::Result<fs::path> wallet::GetWalletPath(const std::string&)’
       85 | util::Result<fs::path> GetWalletPath(const std::string& name);
          |                        ^~~~~~~~~~~~~
    

    Probably fails because I always use -DCMAKE_COMPILE_WARNING_AS_ERROR=ON


    maflcko commented at 6:11 PM on November 17, 2026:

    Ah, the CI and I use clang, which doesn't detect this.

  109. DrahtBot added the label CI failed on Nov 17, 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-20 15:51 UTC

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