bitcoin icon indicating copy to clipboard operation
bitcoin copied to clipboard

test: use ForkGenerator to deduplicate reorg test code

Open yuvicc opened this issue 4 months ago • 1 comments

Deduplicate reorg test code by introducing ForkGenerator utility class in blocktools.py.

Changes

  • Add ForkGenerator class with prepare_fork() / trigger_reorg() / reset() methods
  • Removes duplicated trigger_reorg() methods across tests
  • Update mempool tests to use the new utility

For now I am keeping it as draft as we need to address other tests to eliminate use of invalidate_block for reorg scenario. Also, optional args for non-empty forks to test mix-and-match cases of transactions re-entering mempool as suggested by instagibbs in https://github.com/bitcoin/bitcoin/pull/32587#issuecomment-3549356286.

yuvicc avatar Nov 27 '25 05:11 yuvicc

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

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33959.

Reviews

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #33616 (policy: don't CheckEphemeralSpends on reorg by instagibbs)

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.

LLM Linter (✨ experimental)

Possible typos and grammar issues:

  • triggered.. -> triggered. [Double period at end of sentence in the ForkGenerator class docstring makes the sentence look like a typo and may distract; replace with a single period.]

2025-12-13

DrahtBot avatar Nov 27 '25 05:11 DrahtBot