test: split `CreateNewBlock_validity` into independent test cases #36852

pull yuvicc wants to merge 2 commits into bitcoin:master from yuvicc:test-declarative-miner-basic changing 1 files +198 −168
  1. yuvicc commented at 10:49 AM on November 13, 2026: contributor

    CreateNewBlock_validity mines a 110-block chain and then runs four subtests on it as member functions. The subtests share one chain, so each starts from whatever the previous one left behind, and the caller has to patch Tip()->nHeight between them. Inside TestBasicMining a single CMutableTransaction is reused across all sections, with each section overwriting some of its fields, so the transaction a section actually tests depends on every section before it.

    This PR removes both kinds of hidden state.

  2. test: construct TestBasicMining transactions declaratively
    Construct the transactions of each TestBasicMining section in place
    instead of reusing a single transaction across all sections and
    overwriting some of its fields.
    838e901e90
  3. test: split CreateNewBlock_validity into separate test cases
    The sub-tests ran as member functions on one shared chain, so each
    started from the state the previous one left behind and the caller had
    to patch Tip()->nHeight between them.
    
    Make them independent test cases, each mining the BLOCKINFO chain via a
    new MineBlockInfoChain() helper. The blocks use hardcoded nonces, so
    doing this once per case is cheap.
    7e81f5046e
  4. DrahtBot added the label Tests on Nov 13, 2026
  5. DrahtBot commented at 10:50 AM on November 13, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36156 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36156.svg"></sub> (mining: include chunks that reach block limits by l0rinc)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

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

    • src/test/miner_tests.cpp: BOOST_CHECK_THROW(block_template->submitSolutionOld7(...), std::runtime_error) → Prefer BOOST_CHECK_EXCEPTION(..., std::runtime_error, HasReason{"<expected failure message>"}) to check the specific error.

    <sup>2026-11-13 10:50:19</sup>

  6. yuvicc renamed this:
    test: split CreateNewBlock_validity into independent test cases
    test: split `CreateNewBlock_validity` into independent test cases
    on Nov 16, 2026
Contributors
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-11-18 16:51 UTC

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