. #35353

pull TianYuBaBg wants to merge 1 commits into bitcoin:master from TianYuBaBg:fix/encryptwallet-assert-replacement changing 1 files +6 −2
  1. TianYuBaBg commented at 8:49 PM on May 21, 2026: none

    .

  2. wallet: Replace assert(false) with CHECK_NONFATAL(false) in EncryptWallet
    In CWallet::EncryptWallet(), two assert(false) calls serve as fatal
    error handlers for unrecoverable states -- when an SPK manager's
    Encrypt() fails mid-loop, and when the database TxnCommit() fails.
    
    assert() is semantically a debug aid. Replace it with the project's
    existing CHECK_NONFATAL(false) pattern, which:
    
    - In production: throws NonFatalCheckError, caught by the RPC server
      and returned as RPC_MISC_ERROR to the caller with a clear message.
    - In debug/fuzz builds (ABORT_ON_FAILED_ASSUME): still aborts,
      preserving the original crash-for-testing behavior.
    
    Additionally, clean up the master key entry that was optimistically
    added before the loop, so that HasEncryptionKeys() does not falsely
    report the wallet as encrypted after the failure.
    205dfb8454
  3. DrahtBot added the label Wallet on May 21, 2026
  4. DrahtBot commented at 8:49 PM on May 21, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. achow101 commented at 8:52 PM on May 21, 2026: member

    No.

  6. achow101 closed this on May 21, 2026

  7. achow101 commented at 8:53 PM on May 21, 2026: member
  8. TianYuBaBg commented at 8:55 PM on May 21, 2026: none

    Understood — the crash is intentional. A corrupted in-memory wallet state is worse than a process restart. Thanks for the explanation, closing.

  9. fanquake renamed this:
    wallet: Replace assert(false) with CHECK_NONFATAL(false) in EncryptWallet
    .
    on May 22, 2026
  10. DrahtBot removed the label Wallet on May 22, 2026
  11. bitcoin locked this on May 22, 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-05-31 17:51 UTC

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