LCOV - code coverage report
Current view: top level - src - chainparamsbase.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 4 4 100.0 %
Date: 2020-09-26 01:30:44 Functions: 6 6 100.0 %

          Line data    Source code
       1             : // Copyright (c) 2014-2019 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             : 
      13             : /**
      14             :  * CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind)
      15             :  * of a given instance of the Bitcoin system.
      16             :  */
      17       12196 : class CBaseChainParams
      18             : {
      19             : public:
      20             :     ///@{
      21             :     /** Chain name strings */
      22             :     static const std::string MAIN;
      23             :     static const std::string TESTNET;
      24             :     static const std::string REGTEST;
      25             :     ///@}
      26             : 
      27        2411 :     const std::string& DataDir() const { return strDataDir; }
      28        5251 :     int RPCPort() const { return nRPCPort; }
      29             : 
      30             :     CBaseChainParams() = delete;
      31       12196 :     CBaseChainParams(const std::string& data_dir, int rpc_port) : nRPCPort(rpc_port), strDataDir(data_dir) {}
      32             : 
      33             : private:
      34             :     int nRPCPort;
      35             :     std::string strDataDir;
      36             : };
      37             : 
      38             : /**
      39             :  * Creates and returns a std::unique_ptr<CBaseChainParams> of the chosen chain.
      40             :  * @returns a CBaseChainParams* of the chosen chain.
      41             :  * @throws a std::runtime_error if the chain is not supported.
      42             :  */
      43             : std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain);
      44             : 
      45             : /**
      46             :  *Set the arguments for chainparams
      47             :  */
      48             : void SetupChainParamsBaseOptions(ArgsManager& argsman);
      49             : 
      50             : /**
      51             :  * Return the currently selected parameters. This won't change after app
      52             :  * startup, except for unit tests.
      53             :  */
      54             : const CBaseChainParams& BaseParams();
      55             : 
      56             : /** Sets the params returned by Params() to those for the given network. */
      57             : void SelectBaseParams(const std::string& chain);
      58             : 
      59             : #endif // BITCOIN_CHAINPARAMSBASE_H

Generated by: LCOV version 1.15