Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
CreateNewBlock_validity into independent test cases
Construct the transactions of each TestBasicMining section in place instead of reusing a single transaction across all sections and overwriting some of its fields.
Move the loop that mines the hardcoded BLOCKINFO chain out of CreateNewBlock_validity into a MineBlockInfoChain() helper on MinerTestingSetup, returning txFirst and baseheight. The coinbase output script becomes a file-level COINBASE_OUTPUT_SCRIPT constant so the helper can use it. This is a move-only refactor in preparation for splitting the sub-tests into independent 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 `MineBlockInfoChain()`. The blocks use hardcoded nonces, so doing this once per case is cheap.
Use `BOOST_CHECK_EXCEPTION` with HasReason instead of `BOOST_CHECK_THROW` so the test asserts the specific deprecation error rather than any `std::runtime_error`.
7e81f50 to
13847d5
Compare
|
ralph review:
Split the helper extraction into its own commit (71204c4). It's move-only. Addressed the LLM linter comment: |

CreateNewBlock_validitymines 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 patchTip()->nHeightbetween them. InsideTestBasicMininga singleCMutableTransactionis 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.