p2p: Drop unsolicited CMPCTBLOCK from non-HB peer #32606

pull davidgumberg wants to merge 2 commits into bitcoin:master from davidgumberg:5-23-25-ignore-unsolicited changing 3 files +85 −0
  1. davidgumberg commented at 9:58 pm on May 23, 2025: contributor

    Processing unsolicited CMPCTBLOCK’s from a peer that has not been marked high bandwidth is not well-specified behavior in BIP-0152, in fact the BIP seems to imply that it is not permitted:

    “[…] method is not useful for compact blocks because cmpctblock blocks can be sent unsolicitedly in high-bandwidth mode”

    See https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki#separate-version-for-segregated-witness

    This partially mitigates a mempool leak described in #28272, making it only possible for peers selected as high bandwidth to discover a node’s mempool.

  2. p2p: Drop unsolicited CMPCTBLOCK from non-HB peer
    Processing unsolicited CMPCTBLOCK's from a peer that has not been marked
    high bandwidth is not well-specified behavior in BIP-0152, in fact the
    BIP seems to imply that it is not permitted:
    
    "[...] method is not useful for compact blocks because `cmpctblock`
    blocks can be sent unsolicitedly in high-bandwidth mode"
    
    See https://github.com/bitcoin/bips/blob/master/bip-0152.mediawiki#separate-version-for-segregated-witness
    
    This partially mitigates a mempool leak described in
    [#28272](https://github.com/bitcoin/bitcoin/issues/28272), making it
    only possible for peers selected as high bandwidth to discover a node's
    mempool.
    13ca017017
  3. test: p2p: Nodes ignore unsolicited CMPCTBLOCK's 28086e7b99
  4. DrahtBot commented at 9:58 pm on May 23, 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/32606.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK jonatack

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

    LLM Linter (✨ experimental)

    Possible typos and grammar issues:

    • high-bandwidth sent -> high-bandwidth, sent [Missing comma creates a grammatically invalid phrase, impacting comprehension of the sentence structure.]

    drahtbot_id_0520

  5. DrahtBot added the label P2P on May 23, 2025
  6. in test/functional/p2p_compactblocks.py:779 in 13ca017017 outdated
    775@@ -763,6 +776,7 @@ def announce_cmpct_block(node, peer):
    776                 assert "getblocktxn" in peer.last_message
    777             return block, cmpct_block
    778 
    779+
    


    davidgumberg commented at 10:10 pm on May 23, 2025:
    I’ll delete this on next rebase.
  7. jonatack commented at 10:16 pm on May 23, 2025: member
    Concept ACK. BIP152 is marked as Final but perhaps could be clarified on this point.

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-05-25 21:12 UTC

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