Deduplicate reorg test code by introducing ForkGenerator utility class in blocktools.py.
Changes
- Add
ForkGeneratorclass withprepare_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 #32587 (comment).