LCOV - code coverage report
Current view: top level - src - chainparamsbase.h (source / functions) Coverage Total Hit
Test: test_bitcoin_coverage.info Lines: 100.0 % 6 6
Test Date: 2024-08-28 04:44:32 Functions: - 0 0
Branches: 41.7 % 24 10

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

Generated by: LCOV version 2.0-1