Coverage Report

Created: 2025-02-21 14:37

/root/bitcoin/src/chainparamsbase.h
Line
Count
Source (jump to first uncovered line)
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
class CBaseChainParams
21
{
22
public:
23
0
    const std::string& DataDir() const { return strDataDir; }
24
0
    uint16_t RPCPort() const { return m_rpc_port; }
25
26
    CBaseChainParams() = delete;
27
    CBaseChainParams(const std::string& data_dir, uint16_t rpc_port)
28
0
        : m_rpc_port(rpc_port), strDataDir(data_dir) {}
29
30
private:
31
    const uint16_t m_rpc_port;
32
    std::string strDataDir;
33
};
34
35
/**
36
 * Creates and returns a std::unique_ptr<CBaseChainParams> of the chosen chain.
37
 */
38
std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const ChainType chain);
39
40
/**
41
 *Set the arguments for chainparams
42
 */
43
void SetupChainParamsBaseOptions(ArgsManager& argsman);
44
45
/**
46
 * Return the currently selected parameters. This won't change after app
47
 * startup, except for unit tests.
48
 */
49
const CBaseChainParams& BaseParams();
50
51
/** Sets the params returned by Params() to those for the given chain. */
52
void SelectBaseParams(const ChainType chain);
53
54
/** List of possible chain / network names  */
55
0
#define LIST_CHAIN_NAMES "main, test, testnet4, signet, regtest"
56
57
#endif // BITCOIN_CHAINPARAMSBASE_H