]> Git Repo - VerusCoin.git/blob - src/chainparamsbase.h
Merge pull request #5214
[VerusCoin.git] / src / chainparamsbase.h
1 // Copyright (c) 2014 The Bitcoin 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 BITCOIN_CHAINPARAMSBASE_H
6 #define BITCOIN_CHAINPARAMSBASE_H
7
8 #include <string>
9 #include <vector>
10
11 /**
12  * CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind)
13  * of a given instance of the Bitcoin system.
14  */
15 class CBaseChainParams
16 {
17 public:
18     enum Network {
19         MAIN,
20         TESTNET,
21         REGTEST,
22         UNITTEST,
23
24         MAX_NETWORK_TYPES
25     };
26
27     const std::string& DataDir() const { return strDataDir; }
28     int RPCPort() const { return nRPCPort; }
29
30 protected:
31     CBaseChainParams() {}
32
33     int nRPCPort;
34     std::string strDataDir;
35     Network networkID;
36 };
37
38 /**
39  * Return the currently selected parameters. This won't change after app startup
40  * outside of the unit tests.
41  */
42 const CBaseChainParams& BaseParams();
43
44 /** Sets the params returned by Params() to those for the given network. */
45 void SelectBaseParams(CBaseChainParams::Network network);
46
47 /**
48  * Looks for -regtest or -testnet and returns the appropriate Network ID.
49  * Returns MAX_NETWORK_TYPES if an invalid combination is given.
50  */
51 CBaseChainParams::Network NetworkIdFromCommandLine();
52
53 /**
54  * Calls NetworkIdFromCommandLine() and then calls SelectParams as appropriate.
55  * Returns false if an invalid combination is given.
56  */
57 bool SelectBaseParamsFromCommandLine();
58
59 /**
60  * Return true if SelectBaseParamsFromCommandLine() has been called to select
61  * a network.
62  */
63 bool AreBaseParamsConfigured();
64
65 #endif // BITCOIN_CHAINPARAMSBASE_H
This page took 0.028098 seconds and 4 git commands to generate.