LCOV - code coverage report
Current view: top level - src - chainparamsbase.h (source / functions) Hit Total Coverage
Test: fuzz_coverage.info Lines: 5 6 83.3 %
Date: 2023-11-10 23:46:46 Functions: 5 5 100.0 %
Branches: 0 0 -

           Branch data     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 <util/chaintype.h>
       9                 :            : 
      10                 :            : #include <memory>
      11                 :            : #include <string>
      12                 :            : 
      13                 :            : class ArgsManager;
      14                 :            : 
      15                 :            : /**
      16                 :            :  * CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind)
      17                 :            :  * of a given instance of the Bitcoin system.
      18                 :            :  */
      19                 :          0 : class CBaseChainParams
      20                 :            : {
      21                 :            : public:
      22                 :          6 :     const std::string& DataDir() const { return strDataDir; }
      23                 :          4 :     uint16_t RPCPort() const { return m_rpc_port; }
      24                 :          4 :     uint16_t OnionServiceTargetPort() const { return m_onion_service_target_port; }
      25                 :            : 
      26                 :            :     CBaseChainParams() = delete;
      27                 :          5 :     CBaseChainParams(const std::string& data_dir, uint16_t rpc_port, uint16_t onion_service_target_port)
      28                 :          5 :         : m_rpc_port(rpc_port), m_onion_service_target_port(onion_service_target_port), strDataDir(data_dir) {}
      29                 :            : 
      30                 :            : private:
      31                 :            :     const uint16_t m_rpc_port;
      32                 :            :     const uint16_t m_onion_service_target_port;
      33                 :            :     std::string strDataDir;
      34                 :            : };
      35                 :            : 
      36                 :            : /**
      37                 :            :  * Creates and returns a std::unique_ptr<CBaseChainParams> of the chosen chain.
      38                 :            :  */
      39                 :            : std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const ChainType chain);
      40                 :            : 
      41                 :            : /**
      42                 :            :  *Set the arguments for chainparams
      43                 :            :  */
      44                 :            : void SetupChainParamsBaseOptions(ArgsManager& argsman);
      45                 :            : 
      46                 :            : /**
      47                 :            :  * Return the currently selected parameters. This won't change after app
      48                 :            :  * startup, except for unit tests.
      49                 :            :  */
      50                 :            : const CBaseChainParams& BaseParams();
      51                 :            : 
      52                 :            : /** Sets the params returned by Params() to those for the given chain. */
      53                 :            : void SelectBaseParams(const ChainType chain);
      54                 :            : 
      55                 :            : #endif // BITCOIN_CHAINPARAMSBASE_H

Generated by: LCOV version 1.14