validation: remove BLOCK_FAILED_CHILD #32950

pull stratospher wants to merge 5 commits into bitcoin:master from stratospher:2025_02_remove_block_failed_child changing 7 files +38 −56
  1. stratospher commented at 3:04 pm on July 11, 2025: contributor

    Fixes #32173

    even though we have a distinction between BLOCK_FAILED_VALID and BLOCK_FAILED_CHILD in the codebase, we don’t use it for anything. Whenever we check for BlockStatus, we use BLOCK_FAILED_MASK which encompasses both of them.

    Since there is no functional difference between BLOCK_FAILED_VALID and BLOCK_FAILED_CHILD and it’s added code complexity to correctly categorise them (ex: #31405 (review), #16856 (comment)), we could just remove it.

    Looking for conceptual feedback on whether it’s better to improve handling of BLOCK_FAILED_CHILD in the codebase or remove BLOCK_FAILED_CHILD.

    Of less relevance, but it would also fix a reconsiderblock crash that could happen in the situation mentioned in #32173 (comment)

    Similar attempt in the past in #16856 (comment)

  2. validation: don't update BLOCK_FAILED_VALID to BLOCK_FAILED_CHILD in InvalidateBlock
    - there is no functional difference between BLOCK_FAILED_VALID and BLOCK_FAILED_CHILD
    and it's unnecessary code complexity to correctly categorise them.
    d121579abc
  3. refactor/validation: remove to_mark_failed
    to_mark_failed was useful to track last disconnected block so that
    it's children can be marked as BLOCK_FAILED_CHILD. since the previous
    commit removes BLOCK_FAILED_CHILD, the existing variable
    invalid_walk_tip is sufficient.
    
    invalid_walk_tip can track the last disconnected block
    since we exit out of the loop before invalid_walk_tip is reset. this
    is needed in code later on to mark last disconnected block as invalid.
    ca2421d527
  4. validation: remove BLOCK_FAILED_CHILD
    even though we have a distinction between BLOCK_FAILED_VALID
    and BLOCK_FAILED_CHILD in the codebase, we don't use it for
    anything. since there's no functional difference between them
    and it's unnecessary code complexity to categorise them correctly,
    just mark as BLOCK_FAILED_VALID instead.
    8935af08c9
  5. validation: remove BLOCK_FAILED_MASK
    since it's the same as BLOCK_FAILED_VALID now
    4200ecf662
  6. validation: reset BLOCK_FAILED_CHILD to BLOCK_FAILED_VALID when loading from disk
    - there maybe existing block indexes stored in disk with
      BLOCK_FAILED_CHILD
    - since they don't exist anymore, clean up block index entries with
      BLOCK_FAILED_CHILD and reset it to BLOCK_FAILED_VALID.
    06db700a13
  7. DrahtBot added the label Validation on Jul 11, 2025
  8. DrahtBot commented at 3:04 pm on July 11, 2025: 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/32950.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK TheCharlatan

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #32843 (validation: invalid block handling followups by mzumsande)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    LLM Linter (✨ experimental)

    Possible typos and grammar issues:

    • exists in disk -> exists on disk [“in disk” is nonstandard; use “on disk”]

    No other typos affecting comprehension were found.

    drahtbot_id_4_m

  9. TheCharlatan commented at 3:32 pm on July 11, 2025: contributor
    Concept ACK
  10. DrahtBot added the label CI failed on Jul 11, 2025

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-07-12 09:13 UTC

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