Bitcoin ABC 0.31.8
P2P Digital Currency
chainparamsbase.cpp
Go to the documentation of this file.
1// Copyright (c) 2010 Satoshi Nakamoto
2// Copyright (c) 2009-2015 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 <common/args.h>
9#include <tinyformat.h>
10#include <util/chaintype.h>
11
12#include <cassert>
13
15 argsman.AddArg(
16 "-chain=<chain>",
17 "Use the chain <chain> (default: main). Allowed values: main, "
18 "test, regtest",
20 argsman.AddArg(
21 "-regtest",
22 "Enter regression test mode, which uses a special chain in which "
23 "blocks can be solved instantly. This is intended for regression "
24 "testing tools and app development. Equivalent to -chain=regtest.",
27 argsman.AddArg("-testnet", "Use the test chain. Equivalent to -chain=test.",
29}
30
31static std::unique_ptr<CBaseChainParams> globalChainBaseParams;
32
36}
37
42std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const ChainType chain) {
43 switch (chain) {
44 case ChainType::MAIN:
45 return std::make_unique<CBaseChainParams>(
46 "", /*rpc_port=*/8332, 8334,
47 /*chronik_port=*/8331,
48 /*chronik_electrum_port=*/50002);
50 return std::make_unique<CBaseChainParams>(
51 "testnet3",
52 /*rpc_port=*/18332, 18334,
53 /*chronik_port=*/18331,
54 /*chronik_electrum_port=*/60002);
56 return std::make_unique<CBaseChainParams>(
57 "regtest", /*rpc_port=*/18443, 18445,
58 /*chronik_port=*/18442,
59 /*chronik_electrum_port=*/60103);
60 }
61 throw std::invalid_argument(
62 strprintf("%s: Invalid ChainType value", __func__));
63}
64
65void SelectBaseParams(const ChainType chain) {
68}
ArgsManager gArgs
Definition: args.cpp:40
const CBaseChainParams & BaseParams()
Return the currently selected parameters.
std::unique_ptr< CBaseChainParams > CreateBaseChainParams(const ChainType chain)
Port numbers for incoming Tor connections (8334, 18334, 38334, 18445) have been chosen arbitrarily to...
static std::unique_ptr< CBaseChainParams > globalChainBaseParams
void SetupChainParamsBaseOptions(ArgsManager &argsman)
Set the arguments for chainparams.
void SelectBaseParams(const ChainType chain)
Sets the params returned by Params() to those for the given chain.
std::string ChainTypeToString(ChainType chain)
Definition: chaintype.cpp:11
ChainType
Definition: chaintype.h:11
@ ALLOW_ANY
disable validation
Definition: args.h:114
@ DEBUG_ONLY
Definition: args.h:128
void SelectConfigNetwork(const std::string &network)
Select the network in use.
Definition: args.cpp:182
void AddArg(const std::string &name, const std::string &help, unsigned int flags, const OptionsCategory &cat)
Add argument.
Definition: args.cpp:589
CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind) of a given ins...
#define strprintf
Format arguments and return the string or write to given std::ostream (see tinyformat::format doc for...
Definition: tinyformat.h:1202
assert(!tx.IsCoinBase())