wallet: fix ancient wallets migration #34198

pull furszy wants to merge 2 commits into bitcoin:master from furszy:2026_wallet_migration_ancient_wallets changing 2 files +30 −3
  1. furszy commented at 8:03 pm on January 3, 2026: member

    We currently fail migration if the wallet does not contain the best block locator. This is a problem for wallets created before #152, which are not storing such record.

    Missing this record is not an error. it simply means the wallet will scan the chain prior to finish migration.

    Note: Originally I wrote the test using a BDB library (bsddb3) but I wasn’t happy with the new dependency, and ended up zeroing the record length manually. I’m not sure this will work on every platform. If it doesn’t, we can just just drop the test as this can be tested manually on any ancient wallet too.

  2. DrahtBot added the label Wallet on Jan 3, 2026
  3. DrahtBot commented at 8:03 pm on January 3, 2026: 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/34198.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Stale ACK bensig

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

    Conflicts

    No conflicts as of last run.

    LLM Linter (✨ experimental)

    Possible places where comparison-specific test macros should replace generic comparisons:

    • test/functional/wallet_migration.py: assert idx != -1, f"{key!r} not found in wallet.dat" -> Use assert_not_equal(idx, -1, f"{key!r} not found in wallet.dat")

    2026-01-07

  4. bensig commented at 0:45 am on January 5, 2026: contributor

    ACK 63a079e7761e8ef94e706eb2103ece4e2a117e50

    Code review ACK. The fix makes sense - ancient pre-#152 wallets shouldn’t fail migration just because they lack the bestblock record.

    Couldn’t run the test locally (requires previous releases for BDB wallet support), but the logic is straightforward.

  5. DrahtBot added the label Needs rebase on Jan 7, 2026
  6. wallet: fix ancient wallets migration
    The best block locator was introduced in #152, previously created
    wallets do not have these record.
    b19742d4a3
  7. test: add coverage for migrating ancient wallets
    Pre-#152 wallets have no best block stored. Test we
    can migrate them.
    785eadf03f
  8. furszy force-pushed on Jan 7, 2026
  9. DrahtBot removed the label Needs rebase on Jan 7, 2026
  10. DrahtBot added the label CI failed on Jan 7, 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-01-14 06:13 UTC

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