LCOV - code coverage report
Current view: top level - src - chainparamsbase.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 5 5 100.0 %
Date: 2026-06-25 07:23:43 Functions: 7 7 100.0 %

          Line data    Source code
       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             : 
      13             : /**
      14             :  * CBaseChainParams defines the base parameters (shared between dash-cli and dashd)
      15             :  * of a given instance of the Dash system.
      16             :  */
      17             : 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 DEVNET;
      25             :     static const std::string REGTEST;
      26             :     ///@}
      27             : 
      28       13262 :     const std::string& DataDir() const { return strDataDir; }
      29       24248 :     uint16_t RPCPort() const { return m_rpc_port; }
      30       17987 :     uint16_t OnionServiceTargetPort() const { return m_onion_service_target_port; }
      31             : 
      32             :     CBaseChainParams() = delete;
      33       50668 :     CBaseChainParams(const std::string& data_dir, uint16_t rpc_port, uint16_t onion_service_target_port)
      34       50668 :         : 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;
      38             :     const uint16_t m_onion_service_target_port;
      39             :     std::string strDataDir;
      40             : };
      41             : 
      42             : /**
      43             :  * Creates and returns a std::unique_ptr<CBaseChainParams> of the chosen chain.
      44             :  * @returns a CBaseChainParams* of the chosen chain.
      45             :  * @throws a std::runtime_error if the chain is not supported.
      46             :  */
      47             : std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain);
      48             : 
      49             : /**
      50             :  *Set the arguments for chainparams
      51             :  */
      52             : void SetupChainParamsBaseOptions(ArgsManager& argsman);
      53             : 
      54             : /**
      55             :  * Return the currently selected parameters. This won't change after app
      56             :  * startup, except for unit tests.
      57             :  */
      58             : const CBaseChainParams& BaseParams();
      59             : 
      60             : /** Sets the params returned by Params() to those for the given network. */
      61             : void SelectBaseParams(const std::string& chain);
      62             : 
      63             : #endif // BITCOIN_CHAINPARAMSBASE_H

Generated by: LCOV version 1.16