wallet: reject invalid cached xpubs at load #36638

pull fametrano wants to merge 1 commits into bitcoin:master from fametrano:wallet-cache-invalid-xpub changing 2 files +47 −8
  1. fametrano commented at 5:59 AM on October 24, 2026: none

    A wallet file whose descriptor cache holds an invalid extended public key aborts the process at load, in an assertion in CPubKey::Derive.

    Unserializing such a key leaves it empty. The cache loaders stored the empty key. A key is invalid if its public key is not a valid point, or if it has depth 0 and a non-zero child number or fingerprint. I return DBErrors::CORRUPT for such a record in both caches, as for a record of the wrong size. I tested this with the extended unit test, which fails without the change and passes with it. A modified wallet file aborted bitcoin-wallet before and reports a corrupt wallet now.

    This is one of several PRs from a large audit of Bitcoin Core that I did with the help of LLM tools. The audit produced its evidence all at once, which is why the PRs arrive together. I understand each change fully and will answer review questions myself.

  2. wallet: reject invalid cached xpubs at load
    A wallet file whose descriptor cache holds an invalid extended public
    key aborts the process at load, in an assertion in CPubKey::Derive.
    
    Unserializing such a key leaves it empty. The cache loaders stored the
    empty key. A key is invalid if its public key is not a valid point, or
    if it has depth 0 and a non-zero child number or fingerprint. I return
    DBErrors::CORRUPT for such a record in both caches, as for a record of
    the wrong size. I tested this with the extended unit test, which fails
    without the change and passes with it. A modified wallet file aborted
    bitcoin-wallet before and reports a corrupt wallet now.
    c77e113a31
  3. DrahtBot added the label Wallet on Oct 24, 2026
  4. DrahtBot commented at 5:59 AM on October 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. A summary of reviews will appear here.

    <!--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/test/walletload_tests.cpp: WalletDescriptor(descriptor, 0, 0, 0, 0)

    <sup>2026-10-24 05:59:49</sup>

Contributors
Labels

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-10-30 15:51 UTC

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