Skip to content

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

Closed

Description

@brunoerg

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).

Activity

  1. yancyribbens commented on Jun 16, 2026

    @yancyribbens
    Contributor

    This is I believe the same change I applied in rust-bitcoin rust-bitcoin/rust-bitcoin#6317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions