wallet: warn when encryption cleanup fails #36793

pull l0rinc wants to merge 2 commits into bitcoin:master from l0rinc:l0rinc/wallet-encryption-rewrite-warning changing 4 files +30 −2
  1. l0rinc commented at 6:17 PM on November 6, 2026: contributor

    Problem: Wallet encryption ignores a failed database rewrite after encrypted key records have been committed. Old plaintext key material can remain in unused pages without a warning.

    Fix: Log the cleanup failure while preserving the successful encryption result. The warning advises moving funds to a newly created wallet before relying on at-rest encryption.

  2. test: characterize encryption rewrite failure
    Show that `EncryptWallet()` still returns true and leaves usable encrypted keys when the final database rewrite fails.
    A successful rewrite is the control, and a TODO marks the missing warning for the following fix.
    2683b3bb57
  3. wallet: warn when encryption cleanup fails
    Encrypted key records have already been committed when the final database rewrite runs.
    A failed rewrite can leave old plaintext key bytes in unused pages, so log a warning while keeping the successful encryption result.
    5f7f18b07a
  4. DrahtBot added the label Wallet on Nov 6, 2026
  5. DrahtBot commented at 6:17 PM on November 6, 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-->

  6. achow101 commented at 11:44 PM on November 6, 2026: member

    I prefer that we simply drop this code once encryptwallet is dropped altogether.

    Or alternatively, we do a RAII thing that turns on/off secure_delete as needed, rather than requiring the caller to use VACUUM afterwards which can fail.

  7. achow101 commented at 2:13 AM on November 7, 2026: member

    Prefer #36796

  8. vicjuma commented at 1:27 PM on November 7, 2026: contributor

    Agree with @achow101. Resolving #36027 will remove most of these "post-commit" arms including #35966


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-07 14:51 UTC

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