dash/src/chainparamsbase.h

64 lines
1.9 KiB
C
Raw Normal View History

// Copyright (c) 2014-2020 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
2014-11-03 16:16:40 +01:00
#ifndef BITCOIN_CHAINPARAMSBASE_H
#define BITCOIN_CHAINPARAMSBASE_H
#include <memory>
#include <string>
class ArgsManager;
/**
2015-04-05 23:56:58 +02:00
* CBaseChainParams defines the base parameters (shared between dash-cli and dashd)
* of a given instance of the Dash system.
*/
class CBaseChainParams
{
public:
///@{
/** Chain name strings */
static const std::string MAIN;
static const std::string TESTNET;
Implement named devnets (#1791) * Initial devnet * Move genesis block adding into its own method * Introduce -allowprivatenet to lift limitation on RFC1918 addresses Normally, RFC1918 (192.168.x.x/10.x.x.x/...) addresses are not allowed to be relayed. Also, masternodes won't start when the address is considered invalid. This is needed to test local devnet or regtest based networks. * Lift the requirement of minimum MN age for regtest/devnet * Implement named devnets This allows the creation of multiple independent devnets. Each one is identified by a name which is hardened into a "devnet genesis" block, which is automatically positioned at height 1. Validation rules will ensure that a node from devnet=test1 never be able to accept blocks from devnet=test2. This is done by checking the expected devnet genesis block. The genesis block of the devnet is the same as the one from regtest. This starts the devnet with a very low difficulty, allowing us to fill up needed balances for masternodes very fast. Also, the devnet name is put into the sub-version of the VERSION message. If a node connects to the wrong network, it will immediately be disconnected. * Allow to select multiple addresses from the same group in devnet/regtest The selection code normally only allows to select addresses from the same group (e.g. 192.168.x.x) once. This results in connecting to only a single node in devnet/regtest. * Show the devnet name in the title bar and on the loading screen * Add AllowMultipleAddressesFromGroup to chainparams and use it in net.cpp * Remove unused/unneeded scripts from devnet geneses creation 1. OP_RETURN not needed in input script of devnet genesis 2. genesisOutputScript was unused * Fix copy/paste error in -allowprivatenet description * Improve -devnet parameter error handling - Only allow one of -devnet, -regtest or -testnet - Only allow -devnet=name to be specified once * Use different datadir for each devnet * Fix `devnet-devnet` issue * Fix devnet splashscreen (should use testnet img) * Avoid passing devNetName around (most of the time) * Remove nMaxTipAge from CDevNetParams Not present anymore after rebase on develop
2017-12-20 12:45:01 +01:00
static const std::string DEVNET;
static const std::string REGTEST;
///@}
const std::string& DataDir() const { return strDataDir; }
uint16_t RPCPort() const { return m_rpc_port; }
uint16_t OnionServiceTargetPort() const { return m_onion_service_target_port; }
CBaseChainParams() = delete;
CBaseChainParams(const std::string& data_dir, uint16_t rpc_port, uint16_t onion_service_target_port)
: m_rpc_port(rpc_port), m_onion_service_target_port(onion_service_target_port), strDataDir(data_dir) {}
private:
const uint16_t m_rpc_port;
const uint16_t m_onion_service_target_port;
std::string strDataDir;
};
/**
* Creates and returns a std::unique_ptr<CBaseChainParams> of the chosen chain.
* @returns a CBaseChainParams* of the chosen chain.
* @throws a std::runtime_error if the chain is not supported.
*/
std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain);
/**
*Set the arguments for chainparams
*/
void SetupChainParamsBaseOptions(ArgsManager& argsman);
/**
2015-04-28 16:48:28 +02:00
* 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(const std::string& chain);
2014-11-03 16:16:40 +01:00
#endif // BITCOIN_CHAINPARAMSBASE_H