Also pass in appropriate object to:
- GetNetworkHashPS
- [gG]enerateBlock{,s}
Also:
- Misc style/constness changes
This is a partial backport of core#21391
Depends on D11507
https://github.com/bitcoin/bitcoin/pull/21391/commits/60dc05afc6f6388c6f86729a0edd7cb69f1748e0