[31.x] Backports #36662

pull fanquake wants to merge 4 commits into bitcoin:31.x from fanquake:36358_36361 changing 8 files +91 −6
  1. fanquake commented at 1:08 PM on October 26, 2026: member

    Backports:

  2. net: don't discourage private broadcast peers
    Keep private broadcast connections outside normal discouragement handling.
    Misbehaving private broadcast peers are still disconnected.
    
    Github-Pull: #36312
    Rebased-From: eab6630addc385d013db5fe6779679228e445d09
    13a4e14ca0
  3. validation: Don't add pruned blocks to m_blocks_unlinked on startup
    LoadBlockIndex() adds to m_blocks_unlinked based only on nTx > 0, without
    checking BLOCK_HAVE_DATA. Pruning preserves nTx but clears BLOCK_HAVE_DATA,
    so a pruned block whose parent was header-only gets re-added on every
    restart, causing the CheckBlockIndex() assertion that entries must have
    data on disk to fail.
    
    Check that BLOCK_HAVE_DATA is set before inserting into m_blocks_unlinked.
    
    Fixes #35050.
    
    Github-Pull: #35168
    Rebased-From: 0e4b0bacecf94063342c7f9eb9b03dac8a7a7936
    ea1a787dfa
  4. test: Add coverage for m_blocks_unlinked invariant in LoadBlockIndex
    A pruned stale-fork block whose parent doesn't have any transactions
    shouldn't be added to m_blocks_unlinked when starting up a node.
    
    Github-Pull: #35168
    Rebased-From: 3f44f9aef7ccd0417fcd0c2f33f20615ea5c11e6
    0c432de3df
  5. doc: update release notes for v31.x 1bb872a8c8
  6. fanquake requested review from sedited on Oct 26, 2026
  7. fanquake requested review from marcofleon on Oct 26, 2026
  8. DrahtBot added the label Backport on Oct 26, 2026
  9. fanquake added this to the milestone 31.2 on Oct 26, 2026
  10. DrahtBot commented at 1:08 PM on October 26, 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.

    Type Reviewers
    ACK marcofleon, sedited

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  11. rreview commented at 1:27 PM on October 26, 2026: none

    <!-- ralph-major:bitcoin/bitcoin -->

    Ralph found major issues at 1bb872a8c83c643adc56eece18b7b0864bc9b91b.

    Prune request does not remove the stale-fork block file (test/functional/feature_prune_stale_fork.py:30, head)

    At height 500, the prune request is clamped to height 212 because pruning retains the last 288 blocks. In -fastprune mode, block files roll over at 64 KiB, and the small coinbase-only blocks do not fill the file containing the height-2 stale-fork child by height 212. Manual pruning removes only whole files whose last block height is within the prune limit, so the child remains available and the following getblock assertion fails before restart. Mine enough blocks for the child's file to become eligible for pruning, or otherwise ensure that file is pruned before asserting the error.

    Full report

  12. sedited commented at 1:37 PM on October 26, 2026: contributor

    The Ralph finding looks like nothing to me.

  13. marcofleon approved
  14. marcofleon commented at 1:43 PM on October 26, 2026: contributor

    ACK 1bb872a8c83c643adc56eece18b7b0864bc9b91b

    I think Ralph would maybe be right if the test's chain started from genesis and the fork was at the second block. But that's not the case for this test, as the fork happens at block 201.

    C'mon Ralph...

  15. sedited approved
  16. sedited commented at 1:44 PM on October 26, 2026: contributor

    ACK 1bb872a8c83c643adc56eece18b7b0864bc9b91b

  17. fanquake merged this on Oct 26, 2026
  18. fanquake closed this on Oct 26, 2026

  19. fanquake deleted the branch on Oct 26, 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-10-26 19:51 UTC

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