Merge #12075: [scripts] Add missing univalue file to copyright_header.py
[bitcoinplatinum.git] / src / chainparamsbase.h
blobb4d2bb4f08313d9aad7ceb24615eac8eb0439f2a
1 // Copyright (c) 2014-2017 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 #ifndef BITCOIN_CHAINPARAMSBASE_H
6 #define BITCOIN_CHAINPARAMSBASE_H
8 #include <memory>
9 #include <string>
10 #include <vector>
12 /**
13 * CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind)
14 * of a given instance of the Bitcoin system.
16 class CBaseChainParams
18 public:
19 /** BIP70 chain name strings (main, test or regtest) */
20 static const std::string MAIN;
21 static const std::string TESTNET;
22 static const std::string REGTEST;
24 const std::string& DataDir() const { return strDataDir; }
25 int RPCPort() const { return nRPCPort; }
27 protected:
28 CBaseChainParams() {}
30 int nRPCPort;
31 std::string strDataDir;
34 /**
35 * Creates and returns a std::unique_ptr<CBaseChainParams> of the chosen chain.
36 * @returns a CBaseChainParams* of the chosen chain.
37 * @throws a std::runtime_error if the chain is not supported.
39 std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain);
41 /**
42 * Append the help messages for the chainparams options to the
43 * parameter string.
45 void AppendParamsHelpMessages(std::string& strUsage, bool debugHelp=true);
47 /**
48 * Return the currently selected parameters. This won't change after app
49 * startup, except for unit tests.
51 const CBaseChainParams& BaseParams();
53 /** Sets the params returned by Params() to those for the given network. */
54 void SelectBaseParams(const std::string& chain);
56 /**
57 * Looks for -regtest, -testnet and returns the appropriate BIP70 chain name.
58 * @return CBaseChainParams::MAX_NETWORK_TYPES if an invalid combination is given. CBaseChainParams::MAIN by default.
60 std::string ChainNameFromCommandLine();
62 #endif // BITCOIN_CHAINPARAMSBASE_H