A target field was added to the getblock and getblockheader RPC calls in #31583, but it mistakingly always used the tip value.
This PR fixes it to return the target for the given block. Because regtest does not have difficulty adjustment, the mainnet test is expanded to cover the fix.
A preliminary commit deals with mining block 2016 that’s needed for the test. It also:
- renames the
create_coinbaseretarget_periodargument tohalving_period. Before #31583 this was hardcoded for regtest where these values are the same. - drops unused
feesargument fromminehelper - expands the CPU miner instructions for generating the alternative mainnet chain
Fixes #33440