Summary
Disable the min-difficulty block rule on testnet4 after block height 151,200 (epoch 75 boundary) and reset difficulty to 1,000,000 at the fork.
Motivation
Testnet4’s min-difficulty rule (allowing difficulty-1 blocks after 20 minutes) is being exploited, causing ~85-90% of blocks to be CPU-mined min-difficulty blocks. This results in a race of CPU miners broadcasting blocks at exactly the second that it’s acceptable. This race is so intense that CPU miners have figured out sending empty blocks, as they propagate faster than those that contain transactions, resulting in a network where transactions are confirmed at only the remaining ASIC blocks, that have ~1 hour average block times.
After the fork:
- Min-difficulty blocks will no longer be allowed
- Difficulty resets to 1,000,000 (not 1, to avoid a block storm of thousands of blocks in seconds)
- Normal difficulty retargeting resumes
Changes
- Add
nMinDifficultyBlocksForkHeightconsensus parameter (default 0 = disabled) - Set fork height to 151,200 for testnet4 (epoch 75 boundary, ~31,000 blocks from current height ~120,000)
- Modify
GetNextWorkRequired()to disable min-difficulty rule and reset difficulty at fork - Modify
PermittedDifficultyTransition()to enforce the new rules - Modify
WaitAndCreateNewBlock()in miner to respect the fork - Add unit tests covering pre-fork, at-fork, and post-fork behavior
Test Plan
./build/bin/test_bitcoin --run_test=pow_tests- all 21 tests pass
Discussion
[bitcoin-dev mailing list thread #1](https://groups.google.com/g/bitcoindev/c/iVLHJ1HWhoU)
[bitcoin-dev mailing list thread #2](https://groups.google.com/g/bitcoindev/c/Jsv1VYpewuU)
Bitcointalk thread