Tracking: #33777
Motivation
Currently Mining exposes only isTestChain() -> Bool, which cannot distinguish mainnet, testnet3, testnet4, signet, and regtest. As a result, external IPC mining servers must ask operators to configure network magic bytes and Bech32 HRPs manually, risking misconfiguration across networks.
Similarly, BlockTemplate exposes the initial getBlockHeader(), but does not expose the consensus medianTimePast (MTP) or the node's allowed version-rolling mask / active BIP 9 deployment bits. Mining servers therefore have to approximate ntime lower bounds (ntime >= header.nTime instead of ntime > MTP) and hardcode BIP 323 version-rolling masks (0x1fffffe0).
Proposal
- Add a chain-metadata getter on
Mining(e.g.getChainParams()):chainType :Text(e.g."main","test","testnet4","signet","regtest")networkMagic :UInt32(4-byte P2P message start)bech32Hrp :Text(e.g."bc","tb","bcrt")
- Expose header validation bounds on
BlockTemplate(either as fields on aHeaderBounds/TemplateRulesstruct or getters):medianTimePast :UInt32(exact consensus lower bound fornTime)versionRollingMask :UInt32(or active deployment bitmask so clients know whichnVersionbits are safe to roll)
Both additions are non-breaking and remove duplicated per-network configuration across IPC mining clients.