Changeset View
Changeset View
Standalone View
Standalone View
src/chainparams.h
Show All 31 Lines | |||||
* See also: CChainParams::TxData, GuessVerificationProgress. | * See also: CChainParams::TxData, GuessVerificationProgress. | ||||
*/ | */ | ||||
struct ChainTxData { | struct ChainTxData { | ||||
int64_t nTime; | int64_t nTime; | ||||
int64_t nTxCount; | int64_t nTxCount; | ||||
double dTxRate; | double dTxRate; | ||||
}; | }; | ||||
static std::vector<SeedSpec6> EMPTY_FIXED_SEEDS = {}; | |||||
/** | /** | ||||
* CChainParams defines various tweakable parameters of a given instance of the | * CChainParams defines various tweakable parameters of a given instance of the | ||||
* Bitcoin system. There are three: the main network on which people trade goods | * Bitcoin system. There are three: the main network on which people trade goods | ||||
* and services, the public test network which gets reset from time to time and | * and services, the public test network which gets reset from time to time and | ||||
* a regression test mode which is intended for private networks only. It has | * a regression test mode which is intended for private networks only. It has | ||||
* minimal difficulty to ensure that blocks can be found instantly. | * minimal difficulty to ensure that blocks can be found instantly. | ||||
*/ | */ | ||||
class CChainParams { | class CChainParams { | ||||
public: | public: | ||||
virtual ~CChainParams() {} | |||||
enum Base58Type { | enum Base58Type { | ||||
PUBKEY_ADDRESS, | PUBKEY_ADDRESS, | ||||
SCRIPT_ADDRESS, | SCRIPT_ADDRESS, | ||||
SECRET_KEY, | SECRET_KEY, | ||||
EXT_PUBLIC_KEY, | EXT_PUBLIC_KEY, | ||||
EXT_SECRET_KEY, | EXT_SECRET_KEY, | ||||
MAX_BASE58_TYPES | MAX_BASE58_TYPES | ||||
Show All 28 Lines | public: | ||||
/** Return the BIP70 network string (main, test or regtest) */ | /** Return the BIP70 network string (main, test or regtest) */ | ||||
std::string NetworkIDString() const { return strNetworkID; } | std::string NetworkIDString() const { return strNetworkID; } | ||||
/** Return the list of hostnames to look up for DNS seeds */ | /** Return the list of hostnames to look up for DNS seeds */ | ||||
const std::vector<std::string> &DNSSeeds() const { return vSeeds; } | const std::vector<std::string> &DNSSeeds() const { return vSeeds; } | ||||
const std::vector<uint8_t> &Base58Prefix(Base58Type type) const { | const std::vector<uint8_t> &Base58Prefix(Base58Type type) const { | ||||
return base58Prefixes[type]; | return base58Prefixes[type]; | ||||
} | } | ||||
const std::string &CashAddrPrefix() const { return cashaddrPrefix; } | const std::string &CashAddrPrefix() const { return cashaddrPrefix; } | ||||
const std::vector<SeedSpec6> &FixedSeeds() const { return vFixedSeeds; } | virtual const std::vector<SeedSpec6> &FixedSeeds() const { | ||||
return EMPTY_FIXED_SEEDS; | |||||
} | |||||
const CCheckpointData &Checkpoints() const { return checkpointData; } | const CCheckpointData &Checkpoints() const { return checkpointData; } | ||||
const ChainTxData &TxData() const { return chainTxData; } | const ChainTxData &TxData() const { return chainTxData; } | ||||
protected: | protected: | ||||
CChainParams() {} | CChainParams() {} | ||||
Consensus::Params consensus; | Consensus::Params consensus; | ||||
CMessageHeader::MessageMagic diskMagic; | CMessageHeader::MessageMagic diskMagic; | ||||
CMessageHeader::MessageMagic netMagic; | CMessageHeader::MessageMagic netMagic; | ||||
int nDefaultPort; | int nDefaultPort; | ||||
uint64_t nPruneAfterHeight; | uint64_t nPruneAfterHeight; | ||||
uint64_t m_assumed_blockchain_size; | uint64_t m_assumed_blockchain_size; | ||||
uint64_t m_assumed_chain_state_size; | uint64_t m_assumed_chain_state_size; | ||||
std::vector<std::string> vSeeds; | std::vector<std::string> vSeeds; | ||||
std::vector<uint8_t> base58Prefixes[MAX_BASE58_TYPES]; | std::vector<uint8_t> base58Prefixes[MAX_BASE58_TYPES]; | ||||
std::string cashaddrPrefix; | std::string cashaddrPrefix; | ||||
std::string strNetworkID; | std::string strNetworkID; | ||||
CBlock genesis; | CBlock genesis; | ||||
std::vector<SeedSpec6> vFixedSeeds; | |||||
bool fDefaultConsistencyChecks; | bool fDefaultConsistencyChecks; | ||||
bool fRequireStandard; | bool fRequireStandard; | ||||
bool m_is_test_chain; | bool m_is_test_chain; | ||||
bool m_is_mockable_chain; | bool m_is_mockable_chain; | ||||
CCheckpointData checkpointData; | CCheckpointData checkpointData; | ||||
ChainTxData chainTxData; | ChainTxData chainTxData; | ||||
}; | }; | ||||
class CMainParams : public CChainParams { | |||||
public: | |||||
CMainParams(); | |||||
const std::vector<SeedSpec6> &FixedSeeds() const override; | |||||
}; | |||||
class CTestNetParams : public CChainParams { | |||||
public: | |||||
CTestNetParams(); | |||||
const std::vector<SeedSpec6> &FixedSeeds() const override; | |||||
}; | |||||
class CRegTestParams : public CChainParams { | |||||
public: | |||||
CRegTestParams(); | |||||
}; | |||||
/** | /** | ||||
* Creates and returns a std::unique_ptr<CChainParams> of the chosen chain. | * Creates and returns a std::unique_ptr<CChainParams> of the chosen chain. | ||||
* @returns a CChainParams* of the chosen chain. | * @returns a CChainParams* of the chosen chain. | ||||
* @throws a std::runtime_error if the chain is not supported. | * @throws a std::runtime_error if the chain is not supported. | ||||
*/ | */ | ||||
std::unique_ptr<CChainParams> CreateChainParams(const std::string &chain); | std::unique_ptr<CChainParams> CreateChainParams(const std::string &chain); | ||||
CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, | CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, | ||||
Show All 17 Lines |