SENDCMPCT announce field is not validated against BIP152 (MUST be 0 or 1) #35542

issue brunoerg opened this issue on June 16, 2026
  1. brunoerg commented at 1:49 PM on June 16, 2026: contributor

    When processing a sendcmpct message, the first field (the high-bandwidth announce boolean) is not validated to be 0 or 1. Any non-zero byte is silently accepted and treated as true, which deviates from what the BIP152 says: "The first integer SHALL be interpreted as a boolean (and MUST have a value of either 1 or 0)".

    if (msg_type == NetMsgType::SENDCMPCT) {
        bool sendcmpct_hb{false};
        uint64_t sendcmpct_version{0};
        vRecv >> sendcmpct_hb >> sendcmpct_version;
    
        // Only support compact block relay with witnesses
        if (sendcmpct_version != CMPCTBLOCKS_VERSION) return;
    

    Not super relevant in practice, but just a divergence with the BIP that we noticed while reviewing another impl of compact blocks (cc @MPins).

  2. yancyribbens commented at 3:16 PM on June 16, 2026: contributor

    This is I believe the same change I applied in rust-bitcoin https://github.com/rust-bitcoin/rust-bitcoin/pull/6317


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

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