net: align v2 message type validation with v1 range #35958

pull brunoerg wants to merge 1 commits into bitcoin:master from brunoerg:2026-08-v2-fix changing 2 files +13 −3
  1. brunoerg commented at 1:13 PM on August 12, 2026: contributor

    BIP324 specifies the 13-byte long-form message type encoding as "an ASCII message type (as in the v1 P2P protocol)", but V2Transport::GetMessageType() accepted bytes up to 0x7F, while for V1 it only accepts printable ASCII (0x20-0x7E).

    This changes V2 to match V1 on it and add test coverage.

  2. net: align v2 message type validation with v1 range
    BIP324 specifies the 13-byte long-form message type encoding as
    "an ASCII message type (as in the v1 P2P protocol)", but
    V2Transport::GetMessageType() accepted bytes up to 0x7F, while
    for V1 it only accepts printable ASCII (0x20-0x7E).
    
    This changes V2 to match V1 on it and add test coverage.
    cc577de954
  3. DrahtBot added the label P2P on Aug 12, 2026
  4. DrahtBot commented at 1:13 PM on August 12, 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/35958.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK nervana21, w0xlt, sedited, ajtowns

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. nervana21 commented at 8:56 PM on August 12, 2026: contributor

    tACK cc577de954671378268bab2a78714869b4f7388d

    The changes match CMessageHeader::IsMessageTypeValid and BIP324's "ASCII as in v1" wording.

  6. w0xlt commented at 6:33 PM on August 13, 2026: contributor

    ACK cc577de954671378268bab2a78714869b4f7388d

  7. fanquake requested review from mzumsande on Aug 14, 2026
  8. sedited requested review from ajtowns on Aug 29, 2026
  9. ajtowns commented at 9:41 AM on August 29, 2026: contributor

    The "space to tilde" range has been consistent in v1 since the satoshi days, so seems reasonable. Ultimately just gives a different error ("invalid message type" from net.h rather than "Unknown message type" from net_processing with the unsafe chars skipped), and would be reverted if for some reason we wanted to support a message type with weird characters.

    utACK ca7162cde58e69214a3309c17fac6d666b5f055a

  10. sedited approved
  11. sedited commented at 12:31 PM on August 29, 2026: contributor

    ACK cc577de954671378268bab2a78714869b4f7388d

  12. sedited commented at 12:43 PM on August 29, 2026: contributor

    @ajtowns you ACKed a commit different from the head, was that a mis-paste?

  13. ajtowns commented at 12:29 AM on September 3, 2026: contributor

    @ajtowns you ACKed a commit different from the head, was that a mis-paste?

    Yeah, that was current master.

    utACK cc577de954671378268bab2a78714869b4f7388d

  14. fanquake merged this on Sep 3, 2026
  15. fanquake closed this on Sep 3, 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-09-09 07:56 UTC