test: cover compact blocks far ahead of the tip #36410

pull fametrano wants to merge 1 commits into bitcoin:master from fametrano:test-cmpctblock-revert-to-headers changing 2 files +85 −0
  1. fametrano commented at 7:15 AM on October 2, 2026: contributor

    This adds a test that passes on master and fails with the diff from #34618 applied, as davidgumberg asked in #34722. It covers both things that diff removes for a compact block more than two blocks ahead of the tip.

    If the node already requested the block from this peer, it sends another getdata for the full block. Without that getdata, the block stays in flight from this peer and nothing requests it again until the block download timeout disconnects the peer. This check is the one shuv-amp proposed in #34722.

    Otherwise, from a high-bandwidth peer, the node handles the header as a headers message (fRevertToHeaderProcessing). Most of that work is done anyway. As 151henry151 pointed out in #34618, one part is not: protecting an outbound peer from eviction (m_chain_sync.m_protect). The test checks for the "Protecting outbound peer" debug log line.

    Each check fails when only its branch is disabled: fRevertToHeaderProcessing = false fails the protection check, and if (false) in place of if (requested_block_from_this_peer) makes the getdata check time out. shuv-amp first tested the two branches separately in #34618.

    Fixes #34618.

    Written with LLM, a computer and the Internet; the mistakes, as usual, are all mine.

  2. test: cover compact blocks far ahead of the tip
    A compact block more than two blocks ahead of the tip is not
    reconstructed. If the node requested it from that peer, it asks for the
    full block again. Otherwise it handles the header as a headers message
    (fRevertToHeaderProcessing). No test checked what either branch does,
    so removing both made no test fail.
    
    The new test checks that the node sends a second getdata for a requested
    block, and that an outbound high-bandwidth peer announcing such a block
    is protected from eviction. Only the headers path sets that protection.
    
    Each check fails if its branch in net_processing.cpp is disabled.
    661373c665
  3. DrahtBot added the label Tests on Oct 2, 2026
  4. DrahtBot commented at 7:15 AM on October 2, 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/36410.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->


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-05 20:51 UTC

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