Crash on launch in PruneBlockIndexCandidates #33129

issue nervana21 openend this issue on August 3, 2025
  1. nervana21 commented at 2:09 pm on August 3, 2025: contributor

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    setBlockIndexCandidates can become empty if the chain tip is not included in the set, which violates an internal invariant and leads to a crash during FindMostWorkChain(). This issue and potential solutions were originally surfaced by ataraxia009 in #33127.

    Expected behaviour

    After pruning, the active tip must be present in the candidate set. No crash should occur in FindMostWorkChain().

    Steps to reproduce

    Mine a chain Manually remove the tip from setBlockIndexCandidates Call PruneBlockIndexCandidates() Observe that setBlockIndexCandidates no longer contains the tip -> This violates an invariant relied upon by FindMostWorkChain()

    Relevant log output

    No response

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    v29.99.0-75ed673

    Operating system and version

    Mac

    Machine specifications

    No response

  2. Ataraxia009 commented at 4:03 pm on August 3, 2025: none

    The issue I was addressing has nothing to do with FindMostWorkChain or a crash in it.

    The root issue that I witnessed was a crash on launch in PruneBlockIndexCandidates which is caused by the data dir reaching a bad state.

    In this state, the block validity of the block indexes in the setBlockIndexCandidates was correct, i.e.: BLOCK_VALID_TRANSACTIONS, but the block validity for the blocks that were used to to build the CoinsView and therefore the M_Chain did not have their required block validity, i.e BLOCK_VALID_SCRIPTS, the blocks with neither BLOCK_VALID_SCRIPTS nor BLOCK_VALID_TRANSACTIONS were being used as the m_chain.tip. Which should not be the case.

    This caused all the setBlockIndexCandidates to have lesser work than the m_chain.Tip. Leaving the setBlockIndexCandidates empty after the PruneBlockIndexCandidates call during launch.

    I cannot figure out how the data got to that state because it seems like this state should never happen.

  3. furszy commented at 4:09 pm on August 3, 2025: member
    Which version of Bitcoin-Core are you running?
  4. maflcko commented at 8:23 am on August 4, 2025: member

    I cannot figure out how the data got to that state because it seems like this state should never happen.

    Bitcoin Core makes heavy use of CPU, RAM and storage IO. Hardware defects might only become visible when running Bitcoin Core. You might want to check your hardware for defects.

    • Use software such as memtest86 to check your RAM.
    • Use software such as linpack, or Prime95 to check the CPU behaviour under load.
    • Use software such as smartctl, fsck, badblocks, or CrystalDiskInfo to test your storage device use.

    Source: https://bitcoin.stackexchange.com/a/12206

  5. nervana21 renamed this:
    Crash when chain tip is missing from candidate set
    Crash on launch in PruneBlockIndexCandidates
    on Aug 5, 2025
  6. nervana21 commented at 0:40 am on August 5, 2025: contributor
    Ahh, okay, my understanding of the problem that Ataraxia009 is having is a bit better now, but I still don’t understand the problem well enough to adequately characterize it better than I’ve done in this issue. I’ve updated the title to more accurately describe what’s believed to be the source of the error
  7. Ataraxia009 commented at 4:43 am on August 5, 2025: none

    Which version of Bitcoin-Core are you running?

    28

  8. Ataraxia009 commented at 4:44 am on August 5, 2025: none

    I cannot figure out how the data got to that state because it seems like this state should never happen.

    Bitcoin Core makes heavy use of CPU, RAM and storage IO. Hardware defects might only become visible when running Bitcoin Core. You might want to check your hardware for defects.

    • Use software such as memtest86 to check your RAM.
    • Use software such as linpack, or Prime95 to check the CPU behaviour under load.
    • Use software such as smartctl, fsck, badblocks, or CrystalDiskInfo to test your storage device use.

    Source: https://bitcoin.stackexchange.com/a/12206

    Possible, but highly doubt it. Ill run some tests anyways.

    Im on a mac with CPU: Apple M2 Max

    Ill find alternatives to the above but if you have suggested ones lmk


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: 2025-08-13 06:13 UTC

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