BIP94 which, amongst others, fixes the timewarp attack on testnet4, has been activated on regtest by #30681 (commit https://github.com/bitcoin/bitcoin/pull/30681/commits/e85f386c4b157b7d1ac16aface9bd2c614e62b46), in order to allow having a functional test for the new testnet4 behavior.
As I argued in #30681#pullrequestreview-2275751672 I believe that regtest’s main task is to test mainnet behavior, and, as such, it shouldn’t diverge from mainnet consensus rules unless there is a very good reason (e.g. for situations where a soft fork has been merged and is a candidate for activation on mainnet). I don’t think testnet4 is a good enough reason - for example, writing test coverage for the actual unfixed timewarp issue will no longer be easily possible in a functional test, and if we end up fixing timwarp in a future softwork we might do it in a slightly different way than BIP94, which seems like it could easily get messy.
Possibilities to fix this (if desired) include:
- allowing to pass consensus parameters via command line (Reviving #17032 or do something similar), so BIP94 would only be active in the subtest where it’s needed.
- rewriting the
mining_basic.py
subtesttest_timewarp
somehow - removing the test for
testnet4
, with the justification that testing mainnet should have priority over testing testnets.