chainparamsbase.h raw
1 // Copyright (c) 2014-2020 The Limenka developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5 #ifndef LIMENKA_CHAINPARAMSBASE_H
6 #define LIMENKA_CHAINPARAMSBASE_H
7
8 #include <util/chaintype.h>
9
10 #include <cstdint>
11 #include <memory>
12 #include <string>
13
14 class ArgsManager;
15
16 static const std::string CONSENSUSRULES_CONFIG_NAME{"consensusrules"};
17 static const std::string CONSENSUSRULES_REQUIRED{"rdts"};
18
19 /**
20 * CBaseChainParams defines the base parameters (shared between limenka-cli and limenkad)
21 * of a given instance of the Limenka system.
22 */
23 class CBaseChainParams
24 {
25 public:
26 const std::string& DataDir() const { return strDataDir; }
27 uint16_t RPCPort() const { return m_rpc_port; }
28
29 CBaseChainParams() = delete;
30 CBaseChainParams(const std::string& data_dir, uint16_t rpc_port)
31 : m_rpc_port(rpc_port), strDataDir(data_dir) {}
32
33 private:
34 const uint16_t m_rpc_port;
35 std::string strDataDir;
36 };
37
38 /**
39 * Creates and returns a std::unique_ptr<CBaseChainParams> of the chosen chain.
40 */
41 std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const ChainType chain);
42
43 /**
44 *Set the arguments for chainparams
45 */
46 void SetupChainParamsBaseOptions(ArgsManager& argsman);
47
48 /**
49 * Return the currently selected parameters. This won't change after app
50 * startup, except for unit tests.
51 */
52 const CBaseChainParams& BaseParams();
53
54 /** Sets the params returned by Params() to those for the given chain. */
55 void SelectBaseParams(const ChainType chain);
56
57 /** List of possible chain / network names */
58 #define LIST_CHAIN_NAMES "main, test, testnet4, signet, regtest, limenka"
59
60 #endif // LIMENKA_CHAINPARAMSBASE_H
61