Several improvements related to chainparams were accumulating in #5229, but they don’t need to add a new option for them to make sense, so I’m taking them ot for discussion. Since there are several somewhat-orthogonal changes here, the scope of the PR will probably be reduced after discussion. There are several changes:
- The use of a more conventional factory is interesting for separating the stateless parts of chainparams later like @theuni planned to do (the stateless factory could remain where it is).
- Replacing the enum with constant strings (suggested by @laanwj ) may not seem very useful by itself, but it allows to unify some things (also simplifies things for the factory).
The most controversial thing is proposing to unify some things for testnet that are already unified for regtest. The first step would be to replace the user-facing strings (including windows’ direct access names) to fit the chain names described in bip70 (use “test” instead of “testnet”). We could also unify the default name for the data directory. That would mean either change the directory file from “testnet3” to “test” (not retro-compatible) or changing the chain name “test” to “testnet3” in BIP70. I don’t understand why “test” was chosen instead of “testnet” for bip70 in the first place so my preference is the later. For the user-facing strings, that would be like having changed directly from “testnet” to “testnet3” (without passing through the current bip70-compatible “test”).