handle InitData() failures in optimistic compact block reconstruction #35479

pull mjthecoder65 wants to merge 1 commits into bitcoin:master from mjthecoder65:net-fix-cmpctblock-initdata-error-handling changing 1 files +4 −2
  1. mjthecoder65 commented at 8:48 AM on June 7, 2026: none

    Summary: In the optimistic compact block reconstruction path (entered when the block is already in-flight from a different peer, or this peer has too many blocks outstanding), InitData() failures were silently ignored behind a// TODO: don't ignore failures\ comment.

    This commit resolves the TODO by distinguishing between the two failure modes, consistent with the handling in the non-optimistic path above (~L4594) and in ProcessCompactBlockTxns (~L3487):

    • READ_STATUS_INVALID: the compact block is malformed. For example an invalid header or data the peer constructed intentionally). Call Misbehaving() on the peer. No RemoveBlockRequest is needed here because BlockRequested was never called for this peer in the optimistic path.
    • READ_STATUS_FAILED: likely a short-id hash collision — not the peer's fault. Return silently as before.
  2. net: handle InitData failures in optimistic compact block reconstruction
    In the optimistic compact block path (block already in-flight from another
    peer), InitData() failures were silently ignored with a TODO comment.
    Distinguish READ_STATUS_INVALID (malformed compact block — misbehavior) from
    READ_STATUS_FAILED (duplicate short ids / hash collision — not misbehavior),
    consistent with how these statuses are handled in the non-optimistic path
    above and in ProcessCompactBlockTxns.
    d9603f9a8b
  3. DrahtBot added the label P2P on Jun 7, 2026
  4. DrahtBot commented at 8:48 AM on June 7, 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/35479.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. mjthecoder65 renamed this:
    net: handle InitData() failures in optimistic compact block reconstruction
    handle InitData() failures in optimistic compact block reconstruction
    on Jun 7, 2026
  6. pinheadmz commented at 10:48 AM on June 7, 2026: member

    Does Misbehaving() lead to a disconnect or any other behavior change? This certainly needs at least a unit test to cover both conditions.

    You are a new contributor and to get review on this submission you will have to do some more work before we spend our limited resources on it. The description reads like it is not just LLM slop output so I'm assuming for now you are a human who is interested in joining the project.

    Since this is a TODO and not closing an issue with a bug or feature request I think you should also find the PR that committed the TODO and explain it in your PR description. Show understanding. Address any comments in the original PR around the TODO and what the behavior change (original and yours) means for normal users of the software.

  7. dergoegge commented at 2:04 PM on June 7, 2026: member
  8. sedited closed this on Jun 7, 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-06-11 10:51 UTC

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