LCOV - code coverage report
Current view: top level - src - chainparamsbase.cpp (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 29 31 93.5 %
Date: 2021-06-29 14:35:33 Functions: 4 4 100.0 %
Legend: Modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed

Not modified by patch:
Lines: hit not hit | Branches: + taken - not taken # not executed
Branches: 7 8 87.5 %

           Branch data     Line data    Source code
#       1                 :            : // Copyright (c) 2010 Satoshi Nakamoto
#       2                 :            : // Copyright (c) 2009-2020 The Bitcoin Core developers
#       3                 :            : // Distributed under the MIT software license, see the accompanying
#       4                 :            : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#       5                 :            : 
#       6                 :            : #include <chainparamsbase.h>
#       7                 :            : 
#       8                 :            : #include <tinyformat.h>
#       9                 :            : #include <util/system.h>
#      10                 :            : 
#      11                 :            : #include <assert.h>
#      12                 :            : 
#      13                 :            : const std::string CBaseChainParams::MAIN = "main";
#      14                 :            : const std::string CBaseChainParams::TESTNET = "test";
#      15                 :            : const std::string CBaseChainParams::SIGNET = "signet";
#      16                 :            : const std::string CBaseChainParams::REGTEST = "regtest";
#      17                 :            : 
#      18                 :            : void SetupChainParamsBaseOptions(ArgsManager& argsman)
#      19                 :       2273 : {
#      20                 :       2273 :     argsman.AddArg("-chain=<chain>", "Use the chain <chain> (default: main). Allowed values: main, test, signet, regtest", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
#      21                 :       2273 :     argsman.AddArg("-regtest", "Enter regression test mode, which uses a special chain in which blocks can be solved instantly. "
#      22                 :       2273 :                  "This is intended for regression testing tools and app development. Equivalent to -chain=regtest.", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
#      23                 :       2273 :     argsman.AddArg("-segwitheight=<n>", "Set the activation height of segwit. -1 to disable. (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
#      24                 :       2273 :     argsman.AddArg("-testnet", "Use the test chain. Equivalent to -chain=test.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
#      25                 :       2273 :     argsman.AddArg("-vbparams=deployment:start:end[:min_activation_height]", "Use given start/end times and min_activation_height for specified version bits deployment (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
#      26                 :       2273 :     argsman.AddArg("-signet", "Use the signet chain. Equivalent to -chain=signet. Note that the network is defined by the -signetchallenge parameter", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
#      27                 :       2273 :     argsman.AddArg("-signetchallenge", "Blocks must satisfy the given script to be considered valid (only for signet networks; defaults to the global default signet test network challenge)", ArgsManager::ALLOW_STRING, OptionsCategory::CHAINPARAMS);
#      28                 :       2273 :     argsman.AddArg("-signetseednode", "Specify a seed node for the signet network, in the hostname[:port] format, e.g. sig.net:1234 (may be used multiple times to specify multiple seed nodes; defaults to the global default signet test network seed node(s))", ArgsManager::ALLOW_STRING, OptionsCategory::CHAINPARAMS);
#      29                 :       2273 : }
#      30                 :            : 
#      31                 :            : static std::unique_ptr<CBaseChainParams> globalChainBaseParams;
#      32                 :            : 
#      33                 :            : const CBaseChainParams& BaseParams()
#      34                 :       5727 : {
#      35                 :       5727 :     assert(globalChainBaseParams);
#      36                 :       5727 :     return *globalChainBaseParams;
#      37                 :       5727 : }
#      38                 :            : 
#      39                 :            : /**
#      40                 :            :  * Port numbers for incoming Tor connections (8334, 18334, 38334, 18445) have
#      41                 :            :  * been chosen arbitrarily to keep ranges of used ports tight.
#      42                 :            :  */
#      43                 :            : std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain)
#      44                 :      11933 : {
#      45         [ +  + ]:      11933 :     if (chain == CBaseChainParams::MAIN) {
#      46                 :       3220 :         return std::make_unique<CBaseChainParams>("", 8332, 8334);
#      47         [ +  + ]:       8713 :     } else if (chain == CBaseChainParams::TESTNET) {
#      48                 :       2425 :         return std::make_unique<CBaseChainParams>("testnet3", 18332, 18334);
#      49         [ +  + ]:       6288 :     } else if (chain == CBaseChainParams::SIGNET) {
#      50                 :       2429 :         return std::make_unique<CBaseChainParams>("signet", 38332, 38334);
#      51         [ +  - ]:       3859 :     } else if (chain == CBaseChainParams::REGTEST) {
#      52                 :       3859 :         return std::make_unique<CBaseChainParams>("regtest", 18443, 18445);
#      53                 :       3859 :     }
#      54                 :          0 :     throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
#      55                 :          0 : }
#      56                 :            : 
#      57                 :            : void SelectBaseParams(const std::string& chain)
#      58                 :       3093 : {
#      59                 :       3093 :     globalChainBaseParams = CreateBaseChainParams(chain);
#      60                 :       3093 :     gArgs.SelectConfigNetwork(chain);
#      61                 :       3093 : }

Generated by: LCOV version 1.14