test: cover P2SH sigop counting in test_witness_sigops #35164

pull musaHaruna wants to merge 1 commits into bitcoin:master from musaHaruna:test/p2sh-sigop-counting changing 1 files +89 −2
  1. musaHaruna commented at 8:25 AM on April 27, 2026: contributor

    Add test coverage for sigop counting in P2SH spends in test_witness_sigops(), addressing the existing TODO.

    The test mirrors the existing P2WSH cases by constructing transactions that:

    • stay below the sigop limit (accepted)
    • exceed the limit (rejected with bad-blk-sigops)
    • reach the limit exactly (accepted)

    Sigop accounting is adjusted for P2SH by applying the legacy 4x cost factor.

    This ensures sigop limits are enforced consistently across both witness and P2SH paths.

  2. test: add P2SH sigop counting coverage
    Implement the TODO in test_witness_sigops by adding tests
    for sigop accounting in P2SH spends.
    
    Mirror the existing P2WSH cases to verify behavior below,
    at, and above the sigop limit. Adjust calculations for the
    legacy 4x sigop cost used in P2SH.
    f3f1a70313
  3. DrahtBot added the label Tests on Apr 27, 2026
  4. DrahtBot commented at 8:25 AM on April 27, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK haishmg

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

    LLM Linter (✨ experimental)

    Possible places where comparison-specific test macros should replace generic comparisons:

    • [test/functional/p2p_segwit.py] assert p2sh_extra_sigops_available < 100 -> consider using assert_greater_than(100, p2sh_extra_sigops_available) instead of a bare comparison assert

    <sup>2026-04-27 08:25:57</sup>

  5. haishmg commented at 4:41 PM on April 28, 2026: none

    ACK f3f1a703137bd9adf492dd67cda3779ae3a2cd8e

    Reviewed the added P2SH sigop coverage in test_witness_sigops. The new cases mirror the existing P2WSH boundary checks and exercise below-limit, over-limit, and exact-limit P2SH spends with legacy sigop cost accounting.

    Ran locally on macOS arm64:

    • build/test/functional/p2p_segwit.py
    • git diff --check upstream/master...HEAD

    I also tried test/lint/lint-python.py test/functional/p2p_segwit.py, but it skipped locally because lief is not installed.

Labels

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-05-02 03:12 UTC

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