Bitcoin Core  21.99.0
P2P Digital Currency
chainparamsbase.h
Go to the documentation of this file.
1 // Copyright (c) 2014-2020 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.
4 
5 #ifndef BITCOIN_CHAINPARAMSBASE_H
6 #define BITCOIN_CHAINPARAMSBASE_H
7 
8 #include <memory>
9 #include <string>
10 
11 class ArgsManager;
12 
18 {
19 public:
21 
22  static const std::string MAIN;
23  static const std::string TESTNET;
24  static const std::string SIGNET;
25  static const std::string REGTEST;
27 
28  const std::string& DataDir() const { return strDataDir; }
29  uint16_t RPCPort() const { return m_rpc_port; }
31 
32  CBaseChainParams() = delete;
33  CBaseChainParams(const std::string& data_dir, uint16_t rpc_port, uint16_t onion_service_target_port)
34  : m_rpc_port(rpc_port), m_onion_service_target_port(onion_service_target_port), strDataDir(data_dir) {}
35 
36 private:
37  const uint16_t m_rpc_port;
39  std::string strDataDir;
40 };
41 
47 std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain);
48 
53 
59 
61 void SelectBaseParams(const std::string& chain);
62 
63 #endif // BITCOIN_CHAINPARAMSBASE_H
CBaseChainParams::m_rpc_port
const uint16_t m_rpc_port
Definition: chainparamsbase.h:37
CBaseChainParams::TESTNET
static const std::string TESTNET
Definition: chainparamsbase.h:23
CBaseChainParams::CBaseChainParams
CBaseChainParams(const std::string &data_dir, uint16_t rpc_port, uint16_t onion_service_target_port)
Definition: chainparamsbase.h:33
CBaseChainParams::strDataDir
std::string strDataDir
Definition: chainparamsbase.h:39
CBaseChainParams
CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind) of a given ins...
Definition: chainparamsbase.h:17
CBaseChainParams::DataDir
const std::string & DataDir() const
Definition: chainparamsbase.h:28
SetupChainParamsBaseOptions
void SetupChainParamsBaseOptions(ArgsManager &argsman)
Set the arguments for chainparams.
Definition: chainparamsbase.cpp:18
CBaseChainParams::OnionServiceTargetPort
uint16_t OnionServiceTargetPort() const
Definition: chainparamsbase.h:30
CBaseChainParams::REGTEST
static const std::string REGTEST
Definition: chainparamsbase.h:25
SelectBaseParams
void SelectBaseParams(const std::string &chain)
Sets the params returned by Params() to those for the given network.
Definition: chainparamsbase.cpp:57
CBaseChainParams::RPCPort
uint16_t RPCPort() const
Definition: chainparamsbase.h:29
CBaseChainParams::MAIN
static const std::string MAIN
Chain name strings.
Definition: chainparamsbase.h:22
CBaseChainParams::m_onion_service_target_port
const uint16_t m_onion_service_target_port
Definition: chainparamsbase.h:38
BaseParams
const CBaseChainParams & BaseParams()
Return the currently selected parameters.
Definition: chainparamsbase.cpp:33
ArgsManager
Definition: system.h:160
CBaseChainParams::CBaseChainParams
CBaseChainParams()=delete
CreateBaseChainParams
std::unique_ptr< CBaseChainParams > CreateBaseChainParams(const std::string &chain)
Creates and returns a std::unique_ptr<CBaseChainParams> of the chosen chain.
Definition: chainparamsbase.cpp:43
CBaseChainParams::SIGNET
static const std::string SIGNET
Definition: chainparamsbase.h:24