// Copyright (c) 2014 The Bitcoin Core developers // Copyright (c) 2016-2024 The Hush developers // Distributed under the GPLv3 software license, see the accompanying // file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html /****************************************************************************** * Copyright © 2014-2019 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * * holder information and the developer policies on copyright and licensing. * * * * Unless otherwise agreed in a custom licensing agreement, no part of the * * SuperNET software, including this file may be copied, modified, propagated * * or distributed except according to the terms contained in the LICENSE file * * * * Removal or modification of this copyright notice is prohibited. * * * ******************************************************************************/ #ifndef HUSH_CHAINPARAMSBASE_H #define HUSH_CHAINPARAMSBASE_H #include #include /** * CBaseChainParams defines the base parameters (shared between bitcoin-cli and bitcoind) * of a given instance of the Bitcoin system. */ class CBaseChainParams { public: enum Network { MAIN, TESTNET, REGTEST, MAX_NETWORK_TYPES }; const std::string& DataDir() const { return strDataDir; } int RPCPort() const { return nRPCPort; } int StratumPort() const { return (RPCPort() + 1000); } protected: CBaseChainParams() {} int nRPCPort = 0; std::string strDataDir; }; /** * Return the currently selected parameters. This won't change after app * startup, except for unit tests. */ const CBaseChainParams& BaseParams(); /** Sets the params returned by Params() to those for the given network. */ void SelectBaseParams(CBaseChainParams::Network network); /** * Looks for -regtest or -testnet and returns the appropriate Network ID. * Returns MAX_NETWORK_TYPES if an invalid combination is given. */ CBaseChainParams::Network NetworkIdFromCommandLine(); /** * Calls NetworkIdFromCommandLine() and then calls SelectParams as appropriate. * Returns false if an invalid combination is given. */ bool SelectBaseParamsFromCommandLine(); /** * Return true if SelectBaseParamsFromCommandLine() has been called to select * a network. */ bool AreBaseParamsConfigured(); #endif // HUSH_CHAINPARAMSBASE_H