Merge #8855: Use a proper factory for creating chainparams
c1082a7 Chainparams: Use the factory for pow tests (Jorge Timón) 2351a06 Chainparams: Get rid of CChainParams& Params(std::string) (Jorge Timón) f87f362 Chainparams: Use a regular factory for creating chainparams (Jorge Timón) Tree-SHA512: 359c8a2a1bc9d02db7856d02810240ada28048ac088f878b575597a7255cdb0ffdd1a647085ee67a34c6a7e7ed9e6cfdb61240cf6e75139619b640dbb096072c
This commit is contained in:
parent
175d68ac21
commit
50652674b5
@ -38,7 +38,7 @@ static void DeserializeAndCheckBlockTest(benchmark::State& state)
|
||||
char a = '\0';
|
||||
stream.write(&a, 1); // Prevent compaction
|
||||
|
||||
Consensus::Params params = Params(CBaseChainParams::MAIN).GetConsensus();
|
||||
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
|
||||
while (state.KeepRunning()) {
|
||||
CBlock block; // Note that CBlock caches its checked state, so we need to recreate it here
|
||||
@ -46,7 +46,7 @@ static void DeserializeAndCheckBlockTest(benchmark::State& state)
|
||||
assert(stream.Rewind(sizeof(raw_bench::block813851)));
|
||||
|
||||
CValidationState validationState;
|
||||
assert(CheckBlock(block, validationState, params, block.GetBlockTime()));
|
||||
assert(CheckBlock(block, validationState, chainParams->GetConsensus(), block.GetBlockTime()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,32 @@ static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits
|
||||
return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
|
||||
}
|
||||
|
||||
|
||||
void CChainParams::UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold)
|
||||
{
|
||||
consensus.vDeployments[d].nStartTime = nStartTime;
|
||||
consensus.vDeployments[d].nTimeout = nTimeout;
|
||||
if (nWindowSize != -1) {
|
||||
consensus.vDeployments[d].nWindowSize = nWindowSize;
|
||||
}
|
||||
if (nThreshold != -1) {
|
||||
consensus.vDeployments[d].nThreshold = nThreshold;
|
||||
}
|
||||
}
|
||||
|
||||
void CChainParams::UpdateDIP3Parameters(int nActivationHeight, int nEnforcementHeight)
|
||||
{
|
||||
consensus.DIP0003Height = nActivationHeight;
|
||||
consensus.DIP0003EnforcementHeight = nEnforcementHeight;
|
||||
}
|
||||
|
||||
void CChainParams::UpdateBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock)
|
||||
{
|
||||
consensus.nMasternodePaymentsStartBlock = nMasternodePaymentsStartBlock;
|
||||
consensus.nBudgetPaymentsStartBlock = nBudgetPaymentsStartBlock;
|
||||
consensus.nSuperblockStartBlock = nSuperblockStartBlock;
|
||||
}
|
||||
|
||||
static CBlock FindDevNetGenesisBlock(const Consensus::Params& params, const CBlock &prevBlock, const CAmount& reward)
|
||||
{
|
||||
std::string devNetName = GetDevNetName();
|
||||
@ -370,7 +396,6 @@ public:
|
||||
};
|
||||
}
|
||||
};
|
||||
static CMainParams mainParams;
|
||||
|
||||
/**
|
||||
* Testnet (v3)
|
||||
@ -529,7 +554,6 @@ public:
|
||||
|
||||
}
|
||||
};
|
||||
static CTestNetParams testNetParams;
|
||||
|
||||
/**
|
||||
* Devnet
|
||||
@ -823,54 +847,26 @@ public:
|
||||
consensus.llmqChainLocks = Consensus::LLMQ_5_60;
|
||||
consensus.llmqForInstantSend = Consensus::LLMQ_5_60;
|
||||
}
|
||||
|
||||
void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold)
|
||||
{
|
||||
consensus.vDeployments[d].nStartTime = nStartTime;
|
||||
consensus.vDeployments[d].nTimeout = nTimeout;
|
||||
if (nWindowSize != -1) {
|
||||
consensus.vDeployments[d].nWindowSize = nWindowSize;
|
||||
}
|
||||
if (nThreshold != -1) {
|
||||
consensus.vDeployments[d].nThreshold = nThreshold;
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateDIP3Parameters(int nActivationHeight, int nEnforcementHeight)
|
||||
{
|
||||
consensus.DIP0003Height = nActivationHeight;
|
||||
consensus.DIP0003EnforcementHeight = nEnforcementHeight;
|
||||
}
|
||||
|
||||
void UpdateBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock)
|
||||
{
|
||||
consensus.nMasternodePaymentsStartBlock = nMasternodePaymentsStartBlock;
|
||||
consensus.nBudgetPaymentsStartBlock = nBudgetPaymentsStartBlock;
|
||||
consensus.nSuperblockStartBlock = nSuperblockStartBlock;
|
||||
}
|
||||
};
|
||||
static CRegTestParams regTestParams;
|
||||
|
||||
static CChainParams *pCurrentParams = 0;
|
||||
static std::unique_ptr<CChainParams> globalChainParams;
|
||||
|
||||
const CChainParams &Params() {
|
||||
assert(pCurrentParams);
|
||||
return *pCurrentParams;
|
||||
assert(globalChainParams);
|
||||
return *globalChainParams;
|
||||
}
|
||||
|
||||
CChainParams& Params(const std::string& chain)
|
||||
std::unique_ptr<CChainParams> CreateChainParams(const std::string& chain)
|
||||
{
|
||||
if (chain == CBaseChainParams::MAIN)
|
||||
return mainParams;
|
||||
return std::unique_ptr<CChainParams>(new CMainParams());
|
||||
else if (chain == CBaseChainParams::TESTNET)
|
||||
return testNetParams;
|
||||
return std::unique_ptr<CChainParams>(new CTestNetParams());
|
||||
else if (chain == CBaseChainParams::DEVNET) {
|
||||
assert(devNetParams);
|
||||
return *devNetParams;
|
||||
return std::unique_ptr<CChainParams>(new CDevNetParams());
|
||||
} else if (chain == CBaseChainParams::REGTEST)
|
||||
return regTestParams;
|
||||
else
|
||||
throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
|
||||
return std::unique_ptr<CChainParams>(new CRegTestParams());
|
||||
throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
|
||||
}
|
||||
|
||||
void SelectParams(const std::string& network)
|
||||
@ -882,22 +878,22 @@ void SelectParams(const std::string& network)
|
||||
}
|
||||
|
||||
SelectBaseParams(network);
|
||||
pCurrentParams = &Params(network);
|
||||
globalChainParams = CreateChainParams(network);
|
||||
}
|
||||
|
||||
void UpdateRegtestBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold)
|
||||
void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold)
|
||||
{
|
||||
regTestParams.UpdateBIP9Parameters(d, nStartTime, nTimeout, nWindowSize, nThreshold);
|
||||
globalChainParams->UpdateBIP9Parameters(d, nStartTime, nTimeout, nWindowSize, nThreshold);
|
||||
}
|
||||
|
||||
void UpdateRegtestDIP3Parameters(int nActivationHeight, int nEnforcementHeight)
|
||||
void UpdateDIP3Parameters(int nActivationHeight, int nEnforcementHeight)
|
||||
{
|
||||
regTestParams.UpdateDIP3Parameters(nActivationHeight, nEnforcementHeight);
|
||||
globalChainParams->UpdateDIP3Parameters(nActivationHeight, nEnforcementHeight);
|
||||
}
|
||||
|
||||
void UpdateRegtestBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock)
|
||||
void UpdateBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock)
|
||||
{
|
||||
regTestParams.UpdateBudgetParameters(nMasternodePaymentsStartBlock, nBudgetPaymentsStartBlock, nSuperblockStartBlock);
|
||||
globalChainParams->UpdateBudgetParameters(nMasternodePaymentsStartBlock, nBudgetPaymentsStartBlock, nSuperblockStartBlock);
|
||||
}
|
||||
|
||||
void UpdateDevnetSubsidyAndDiffParams(int nMinimumDifficultyBlocks, int nHighSubsidyBlocks, int nHighSubsidyFactor)
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "primitives/block.h"
|
||||
#include "protocol.h"
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
struct CDNSSeedData {
|
||||
@ -83,6 +84,9 @@ public:
|
||||
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
|
||||
const CCheckpointData& Checkpoints() const { return checkpointData; }
|
||||
const ChainTxData& TxData() const { return chainTxData; }
|
||||
void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold);
|
||||
void UpdateDIP3Parameters(int nActivationHeight, int nEnforcementHeight);
|
||||
void UpdateBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock);
|
||||
int PoolMinParticipants() const { return nPoolMinParticipants; }
|
||||
int PoolMaxParticipants() const { return nPoolMaxParticipants; }
|
||||
int FulfilledRequestExpireTime() const { return nFulfilledRequestExpireTime; }
|
||||
@ -119,17 +123,19 @@ protected:
|
||||
bool fBIP9CheckMasternodesUpgraded;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates and returns a std::unique_ptr<CChainParams> of the chosen chain.
|
||||
* @returns a CChainParams* of the chosen chain.
|
||||
* @throws a std::runtime_error if the chain is not supported.
|
||||
*/
|
||||
std::unique_ptr<CChainParams> CreateChainParams(const std::string& chain);
|
||||
|
||||
/**
|
||||
* Return the currently selected parameters. This won't change after app
|
||||
* startup, except for unit tests.
|
||||
*/
|
||||
const CChainParams &Params();
|
||||
|
||||
/**
|
||||
* @returns CChainParams for the given BIP70 chain name.
|
||||
*/
|
||||
CChainParams& Params(const std::string& chain);
|
||||
|
||||
/**
|
||||
* Sets the params returned by Params() to those for the given BIP70 chain name.
|
||||
* @throws std::runtime_error when the chain is not supported.
|
||||
@ -139,17 +145,17 @@ void SelectParams(const std::string& chain);
|
||||
/**
|
||||
* Allows modifying the BIP9 regtest parameters.
|
||||
*/
|
||||
void UpdateRegtestBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold);
|
||||
void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold);
|
||||
|
||||
/**
|
||||
* Allows modifying the DIP3 activation and enforcement height
|
||||
*/
|
||||
void UpdateRegtestDIP3Parameters(int nActivationHeight, int nEnforcementHeight);
|
||||
void UpdateDIP3Parameters(int nActivationHeight, int nEnforcementHeight);
|
||||
|
||||
/**
|
||||
* Allows modifying the budget regtest parameters.
|
||||
*/
|
||||
void UpdateRegtestBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock);
|
||||
void UpdateBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock);
|
||||
|
||||
/**
|
||||
* Allows modifying the subsidy and difficulty devnet parameters.
|
||||
|
@ -37,7 +37,6 @@ public:
|
||||
nRPCPort = 9998;
|
||||
}
|
||||
};
|
||||
static CBaseMainParams mainParams;
|
||||
|
||||
/**
|
||||
* Testnet (v3)
|
||||
@ -51,7 +50,6 @@ public:
|
||||
strDataDir = "testnet3";
|
||||
}
|
||||
};
|
||||
static CBaseTestNetParams testNetParams;
|
||||
|
||||
/**
|
||||
* Devnet
|
||||
@ -65,7 +63,6 @@ public:
|
||||
strDataDir = dataDir;
|
||||
}
|
||||
};
|
||||
static CBaseDevNetParams *devNetParams;
|
||||
|
||||
/*
|
||||
* Regression test
|
||||
@ -79,43 +76,32 @@ public:
|
||||
strDataDir = "regtest";
|
||||
}
|
||||
};
|
||||
static CBaseRegTestParams regTestParams;
|
||||
|
||||
static CBaseChainParams* pCurrentBaseParams = 0;
|
||||
static std::unique_ptr<CBaseChainParams> globalChainBaseParams;
|
||||
|
||||
const CBaseChainParams& BaseParams()
|
||||
{
|
||||
assert(pCurrentBaseParams);
|
||||
return *pCurrentBaseParams;
|
||||
assert(globalChainBaseParams);
|
||||
return *globalChainBaseParams;
|
||||
}
|
||||
|
||||
CBaseChainParams& BaseParams(const std::string& chain)
|
||||
std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain)
|
||||
{
|
||||
if (chain == CBaseChainParams::MAIN)
|
||||
return mainParams;
|
||||
return std::unique_ptr<CBaseChainParams>(new CBaseMainParams());
|
||||
else if (chain == CBaseChainParams::TESTNET)
|
||||
return testNetParams;
|
||||
return std::unique_ptr<CBaseChainParams>(new CBaseTestNetParams());
|
||||
else if (chain == CBaseChainParams::DEVNET) {
|
||||
assert(devNetParams);
|
||||
return *devNetParams;
|
||||
return std::unique_ptr<CBaseChainParams>(new CBaseDevNetParams(GetDevNetName()));
|
||||
} else if (chain == CBaseChainParams::REGTEST)
|
||||
return regTestParams;
|
||||
return std::unique_ptr<CBaseChainParams>(new CBaseRegTestParams());
|
||||
else
|
||||
throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
|
||||
}
|
||||
|
||||
void SelectBaseParams(const std::string& chain)
|
||||
{
|
||||
if (chain == CBaseChainParams::DEVNET) {
|
||||
std::string devNetName = GetDevNetName();
|
||||
assert(!devNetName.empty());
|
||||
|
||||
devNetParams = (CBaseDevNetParams*)new uint8_t[sizeof(CBaseDevNetParams)];
|
||||
memset(devNetParams, 0, sizeof(CBaseDevNetParams));
|
||||
new (devNetParams) CBaseDevNetParams(devNetName);
|
||||
}
|
||||
|
||||
pCurrentBaseParams = &BaseParams(chain);
|
||||
globalChainBaseParams = CreateBaseChainParams(chain);
|
||||
}
|
||||
|
||||
std::string ChainNameFromCommandLine()
|
||||
|
@ -5,6 +5,7 @@
|
||||
#ifndef BITCOIN_CHAINPARAMSBASE_H
|
||||
#define BITCOIN_CHAINPARAMSBASE_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -31,6 +32,13 @@ protected:
|
||||
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);
|
||||
|
||||
/**
|
||||
* Append the help messages for the chainparams options to the
|
||||
* parameter string.
|
||||
@ -43,8 +51,6 @@ void AppendParamsHelpMessages(std::string& strUsage, bool debugHelp=true);
|
||||
*/
|
||||
const CBaseChainParams& BaseParams();
|
||||
|
||||
CBaseChainParams& BaseParams(const std::string& chain);
|
||||
|
||||
/** Sets the params returned by Params() to those for the given network. */
|
||||
void SelectBaseParams(const std::string& chain);
|
||||
|
||||
|
@ -32,6 +32,8 @@ static const int CONTINUE_EXECUTION=-1;
|
||||
|
||||
std::string HelpMessageCli()
|
||||
{
|
||||
const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN);
|
||||
const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET);
|
||||
std::string strUsage;
|
||||
strUsage += HelpMessageGroup(_("Options:"));
|
||||
strUsage += HelpMessageOpt("-?", _("This help message"));
|
||||
@ -40,7 +42,7 @@ std::string HelpMessageCli()
|
||||
AppendParamsHelpMessages(strUsage);
|
||||
strUsage += HelpMessageOpt("-named", strprintf(_("Pass named instead of positional arguments (default: %s)"), DEFAULT_NAMED));
|
||||
strUsage += HelpMessageOpt("-rpcconnect=<ip>", strprintf(_("Send commands to node running on <ip> (default: %s)"), DEFAULT_RPCCONNECT));
|
||||
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Connect to JSON-RPC on <port> (default: %u or testnet: %u)"), BaseParams(CBaseChainParams::MAIN).RPCPort(), BaseParams(CBaseChainParams::TESTNET).RPCPort()));
|
||||
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Connect to JSON-RPC on <port> (default: %u or testnet: %u)"), defaultBaseParams->RPCPort(), testnetBaseParams->RPCPort()));
|
||||
strUsage += HelpMessageOpt("-rpcwait", _("Wait for RPC server to start"));
|
||||
strUsage += HelpMessageOpt("-rpcuser=<user>", _("Username for JSON-RPC connections"));
|
||||
strUsage += HelpMessageOpt("-rpcpassword=<pw>", _("Password for JSON-RPC connections"));
|
||||
|
@ -27,7 +27,7 @@ static bool CheckService(const uint256& proTxHash, const ProTx& proTx, CValidati
|
||||
return state.DoS(10, false, REJECT_INVALID, "bad-protx-addr");
|
||||
}
|
||||
|
||||
int mainnetDefaultPort = Params(CBaseChainParams::MAIN).GetDefaultPort();
|
||||
int mainnetDefaultPort = CreateChainParams(CBaseChainParams::MAIN)->GetDefaultPort();
|
||||
if (Params().NetworkIDString() == CBaseChainParams::MAIN) {
|
||||
if (proTx.addr.GetPort() != mainnetDefaultPort) {
|
||||
return state.DoS(10, false, REJECT_INVALID, "bad-protx-addr-port");
|
||||
|
22
src/init.cpp
22
src/init.cpp
@ -434,6 +434,10 @@ void OnRPCPreCommand(const CRPCCommand& cmd)
|
||||
|
||||
std::string HelpMessage(HelpMessageMode mode)
|
||||
{
|
||||
const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN);
|
||||
const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET);
|
||||
const auto defaultChainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
const auto testnetChainParams = CreateChainParams(CBaseChainParams::TESTNET);
|
||||
const bool showDebug = gArgs.GetBoolArg("-help-debug", false);
|
||||
|
||||
// When adding new options to the categories, please keep and ensure alphabetical ordering.
|
||||
@ -445,7 +449,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-blocknotify=<cmd>", _("Execute command when the best block changes (%s in cmd is replaced by block hash)"));
|
||||
if (showDebug)
|
||||
strUsage += HelpMessageOpt("-blocksonly", strprintf(_("Whether to operate in a blocks only mode (default: %u)"), DEFAULT_BLOCKSONLY));
|
||||
strUsage +=HelpMessageOpt("-assumevalid=<hex>", strprintf(_("If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: %s, testnet: %s)"), Params(CBaseChainParams::MAIN).GetConsensus().defaultAssumeValid.GetHex(), Params(CBaseChainParams::TESTNET).GetConsensus().defaultAssumeValid.GetHex()));
|
||||
strUsage +=HelpMessageOpt("-assumevalid=<hex>", strprintf(_("If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: %s, testnet: %s)"), defaultChainParams->GetConsensus().defaultAssumeValid.GetHex(), testnetChainParams->GetConsensus().defaultAssumeValid.GetHex()));
|
||||
strUsage += HelpMessageOpt("-conf=<file>", strprintf(_("Specify configuration file (default: %s)"), BITCOIN_CONF_FILENAME));
|
||||
if (mode == HMM_BITCOIND)
|
||||
{
|
||||
@ -502,7 +506,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-onlynet=<net>", _("Only connect to nodes in network <net> (ipv4, ipv6 or onion)"));
|
||||
strUsage += HelpMessageOpt("-permitbaremultisig", strprintf(_("Relay non-P2SH multisig (default: %u)"), DEFAULT_PERMIT_BAREMULTISIG));
|
||||
strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with bloom filters (default: %u)"), DEFAULT_PEERBLOOMFILTERS));
|
||||
strUsage += HelpMessageOpt("-port=<port>", strprintf(_("Listen for connections on <port> (default: %u or testnet: %u)"), Params(CBaseChainParams::MAIN).GetDefaultPort(), Params(CBaseChainParams::TESTNET).GetDefaultPort()));
|
||||
strUsage += HelpMessageOpt("-port=<port>", strprintf(_("Listen for connections on <port> (default: %u or testnet: %u)"), defaultChainParams->GetDefaultPort(), testnetChainParams->GetDefaultPort()));
|
||||
strUsage += HelpMessageOpt("-proxy=<ip:port>", _("Connect through SOCKS5 proxy"));
|
||||
strUsage += HelpMessageOpt("-proxyrandomize", strprintf(_("Randomize credentials for every proxy connection. This enables Tor stream isolation (default: %u)"), DEFAULT_PROXYRANDOMIZE));
|
||||
strUsage += HelpMessageOpt("-seednode=<ip>", _("Connect to a node to retrieve peer addresses, and disconnect"));
|
||||
@ -547,8 +551,8 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
{
|
||||
strUsage += HelpMessageOpt("-checkblocks=<n>", strprintf(_("How many blocks to check at startup (default: %u, 0 = all)"), DEFAULT_CHECKBLOCKS));
|
||||
strUsage += HelpMessageOpt("-checklevel=<n>", strprintf(_("How thorough the block verification of -checkblocks is (0-4, default: %u)"), DEFAULT_CHECKLEVEL));
|
||||
strUsage += HelpMessageOpt("-checkblockindex", strprintf("Do a full consistency check for mapBlockIndex, setBlockIndexCandidates, chainActive and mapBlocksUnlinked occasionally. Also sets -checkmempool (default: %u)", Params(CBaseChainParams::MAIN).DefaultConsistencyChecks()));
|
||||
strUsage += HelpMessageOpt("-checkmempool=<n>", strprintf("Run checks every <n> transactions (default: %u)", Params(CBaseChainParams::MAIN).DefaultConsistencyChecks()));
|
||||
strUsage += HelpMessageOpt("-checkblockindex", strprintf("Do a full consistency check for mapBlockIndex, setBlockIndexCandidates, chainActive and mapBlocksUnlinked occasionally. Also sets -checkmempool (default: %u)", defaultChainParams->DefaultConsistencyChecks()));
|
||||
strUsage += HelpMessageOpt("-checkmempool=<n>", strprintf("Run checks every <n> transactions (default: %u)", defaultChainParams->DefaultConsistencyChecks()));
|
||||
strUsage += HelpMessageOpt("-checkpoints", strprintf("Disable expensive verification for known chain history (default: %u)", DEFAULT_CHECKPOINTS_ENABLED));
|
||||
strUsage += HelpMessageOpt("-disablesafemode", strprintf("Disable safemode, override a real safe mode event (default: %u)", DEFAULT_DISABLE_SAFEMODE));
|
||||
strUsage += HelpMessageOpt("-testsafemode", strprintf("Force safe mode (default: %u)", DEFAULT_TESTSAFEMODE));
|
||||
@ -617,7 +621,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
|
||||
strUsage += HelpMessageGroup(_("Node relay options:"));
|
||||
if (showDebug) {
|
||||
strUsage += HelpMessageOpt("-acceptnonstdtxn", strprintf("Relay and mine \"non-standard\" transactions (%sdefault: %u)", "testnet/regtest only; ", !Params(CBaseChainParams::TESTNET).RequireStandard()));
|
||||
strUsage += HelpMessageOpt("-acceptnonstdtxn", strprintf("Relay and mine \"non-standard\" transactions (%sdefault: %u)", "testnet/regtest only; ", defaultChainParams->RequireStandard()));
|
||||
strUsage += HelpMessageOpt("-incrementalrelayfee=<amt>", strprintf("Fee rate (in %s/kB) used to define cost of relay, used for mempool limiting and BIP 125 replacement. (default: %s)", CURRENCY_UNIT, FormatMoney(DEFAULT_INCREMENTAL_RELAY_FEE)));
|
||||
strUsage += HelpMessageOpt("-dustrelayfee=<amt>", strprintf("Fee rate (in %s/kB) used to defined dust, the value of an output such that it will cost about 1/3 of its value in fees at this fee rate to spend it. (default: %s)", CURRENCY_UNIT, FormatMoney(DUST_RELAY_TX_FEE)));
|
||||
}
|
||||
@ -643,7 +647,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-rpcuser=<user>", _("Username for JSON-RPC connections"));
|
||||
strUsage += HelpMessageOpt("-rpcpassword=<pw>", _("Password for JSON-RPC connections"));
|
||||
strUsage += HelpMessageOpt("-rpcauth=<userpw>", _("Username and hashed password for JSON-RPC connections. The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. A canonical python script is included in share/rpcuser. The client then connects normally using the rpcuser=<USERNAME>/rpcpassword=<PASSWORD> pair of arguments. This option can be specified multiple times"));
|
||||
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"), BaseParams(CBaseChainParams::MAIN).RPCPort(), BaseParams(CBaseChainParams::TESTNET).RPCPort()));
|
||||
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"), defaultBaseParams->RPCPort(), testnetBaseParams->RPCPort()));
|
||||
strUsage += HelpMessageOpt("-rpcallowip=<ip>", _("Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"));
|
||||
strUsage += HelpMessageOpt("-rpcthreads=<n>", strprintf(_("Set the number of threads to service RPC calls (default: %d)"), DEFAULT_HTTP_THREADS));
|
||||
if (showDebug) {
|
||||
@ -1348,7 +1352,7 @@ bool AppInitParameterInteraction()
|
||||
for (int j=0; j<(int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j)
|
||||
{
|
||||
if (vDeploymentParams[0].compare(VersionBitsDeploymentInfo[j].name) == 0) {
|
||||
UpdateRegtestBIP9Parameters(Consensus::DeploymentPos(j), nStartTime, nTimeout, nWindowSize, nThreshold);
|
||||
UpdateBIP9Parameters(Consensus::DeploymentPos(j), nStartTime, nTimeout, nWindowSize, nThreshold);
|
||||
found = true;
|
||||
LogPrintf("Setting BIP9 activation parameters for %s to start=%ld, timeout=%ld, window=%ld, threshold=%ld\n", vDeploymentParams[0], nStartTime, nTimeout, nWindowSize, nThreshold);
|
||||
break;
|
||||
@ -1378,7 +1382,7 @@ bool AppInitParameterInteraction()
|
||||
if (!ParseInt32(vDIP3Params[1], &nDIP3EnforcementHeight)) {
|
||||
return InitError(strprintf("Invalid nDIP3EnforcementHeight (%s)", vDIP3Params[1]));
|
||||
}
|
||||
UpdateRegtestDIP3Parameters(nDIP3ActivationHeight, nDIP3EnforcementHeight);
|
||||
UpdateDIP3Parameters(nDIP3ActivationHeight, nDIP3EnforcementHeight);
|
||||
}
|
||||
|
||||
if (gArgs.IsArgSet("-budgetparams")) {
|
||||
@ -1403,7 +1407,7 @@ bool AppInitParameterInteraction()
|
||||
if (!ParseInt32(vBudgetParams[2], &nSuperblockStartBlock)) {
|
||||
return InitError(strprintf("Invalid nSuperblockStartBlock (%s)", vBudgetParams[2]));
|
||||
}
|
||||
UpdateRegtestBudgetParameters(nMasternodePaymentsStartBlock, nBudgetPaymentsStartBlock, nSuperblockStartBlock);
|
||||
UpdateBudgetParameters(nMasternodePaymentsStartBlock, nBudgetPaymentsStartBlock, nSuperblockStartBlock);
|
||||
}
|
||||
|
||||
if (chainparams.NetworkIDString() == CBaseChainParams::DEVNET) {
|
||||
|
@ -220,14 +220,16 @@ void PaymentServer::ipcParseCommandLine(int argc, char* argv[])
|
||||
if (GUIUtil::parseBitcoinURI(arg, &r) && !r.address.isEmpty())
|
||||
{
|
||||
CBitcoinAddress address(r.address.toStdString());
|
||||
auto tempChainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
|
||||
if (address.IsValid(Params(CBaseChainParams::MAIN)))
|
||||
if (address.IsValid(*tempChainParams))
|
||||
{
|
||||
SelectParams(CBaseChainParams::MAIN);
|
||||
}
|
||||
else if (address.IsValid(Params(CBaseChainParams::TESTNET)))
|
||||
{
|
||||
SelectParams(CBaseChainParams::TESTNET);
|
||||
else {
|
||||
tempChainParams = CreateChainParams(CBaseChainParams::TESTNET);
|
||||
if (address.IsValid(*tempChainParams))
|
||||
SelectParams(CBaseChainParams::TESTNET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +198,8 @@ void TestPackageSelection(const CChainParams& chainparams, CScript scriptPubKey,
|
||||
// NOTE: These tests rely on CreateNewBlock doing its own self-validation!
|
||||
BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
|
||||
{
|
||||
const CChainParams& chainparams = Params(CBaseChainParams::MAIN);
|
||||
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
const CChainParams& chainparams = *chainParams;
|
||||
CScript scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
|
||||
std::unique_ptr<CBlockTemplate> pblocktemplate, pemptyblocktemplate;
|
||||
CMutableTransaction tx,tx2;
|
||||
|
@ -16,8 +16,7 @@ BOOST_FIXTURE_TEST_SUITE(pow_tests, BasicTestingSetup)
|
||||
/* Test calculation of next difficulty target with DGW */
|
||||
BOOST_AUTO_TEST_CASE(get_next_work)
|
||||
{
|
||||
SelectParams(CBaseChainParams::MAIN);
|
||||
const Consensus::Params& params = Params().GetConsensus();
|
||||
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
|
||||
// build the chain of 24 blocks
|
||||
CBlockIndex blockIndexLast;
|
||||
@ -119,81 +118,75 @@ BOOST_AUTO_TEST_CASE(get_next_work)
|
||||
|
||||
CBlockHeader blockHeader;
|
||||
blockHeader.nTime = 1408732505; // Block #123457
|
||||
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, params), 0x1b1441de); // Block #123457 has 0x1b1441de
|
||||
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, chainParams->GetConsensus()), 0x1b1441de); // Block #123457 has 0x1b1441de
|
||||
|
||||
// test special rules for slow blocks on devnet/testnet
|
||||
gArgs.SoftSetBoolArg("-devnet", true);
|
||||
SelectParams(CBaseChainParams::DEVNET);
|
||||
const Consensus::Params& paramsdev = Params().GetConsensus();
|
||||
const auto chainParamsDev = CreateChainParams(CBaseChainParams::DEVNET);
|
||||
|
||||
// make sure normal rules apply
|
||||
blockHeader.nTime = 1408732505; // Block #123457
|
||||
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, paramsdev), 0x1b1441de); // Block #123457 has 0x1b1441de
|
||||
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x1b1441de); // Block #123457 has 0x1b1441de
|
||||
|
||||
// 10x higher target
|
||||
blockHeader.nTime = 1408733090; // Block #123457 (10m+1sec)
|
||||
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, paramsdev), 0x1c00c8f8); // Block #123457 has 0x1c00c8f8
|
||||
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x1c00c8f8); // Block #123457 has 0x1c00c8f8
|
||||
blockHeader.nTime = 1408733689; // Block #123457 (20m)
|
||||
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, paramsdev), 0x1c00c8f8); // Block #123457 has 0x1c00c8f8
|
||||
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x1c00c8f8); // Block #123457 has 0x1c00c8f8
|
||||
// lowest diff possible
|
||||
blockHeader.nTime = 1408739690; // Block #123457 (2h+1sec)
|
||||
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, paramsdev), 0x207fffff); // Block #123457 has 0x207fffff
|
||||
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x207fffff); // Block #123457 has 0x207fffff
|
||||
blockHeader.nTime = 1408743289; // Block #123457 (3h)
|
||||
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, paramsdev), 0x207fffff); // Block #123457 has 0x207fffff
|
||||
BOOST_CHECK_EQUAL(GetNextWorkRequired(&blockIndexLast, &blockHeader, chainParamsDev->GetConsensus()), 0x207fffff); // Block #123457 has 0x207fffff
|
||||
}
|
||||
|
||||
/* Test the constraint on the upper bound for next work */
|
||||
// BOOST_AUTO_TEST_CASE(get_next_work_pow_limit)
|
||||
// {
|
||||
// SelectParams(CBaseChainParams::MAIN);
|
||||
// const Consensus::Params& params = Params().GetConsensus();
|
||||
// const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
|
||||
// int64_t nLastRetargetTime = 1231006505; // Block #0
|
||||
// CBlockIndex pindexLast;
|
||||
// pindexLast.nHeight = 2015;
|
||||
// pindexLast.nTime = 1233061996; // Block #2015
|
||||
// pindexLast.nBits = 0x1d00ffff;
|
||||
// BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00ffff);
|
||||
// BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00ffff);
|
||||
// }
|
||||
|
||||
/* Test the constraint on the lower bound for actual time taken */
|
||||
// BOOST_AUTO_TEST_CASE(get_next_work_lower_limit_actual)
|
||||
// {
|
||||
// SelectParams(CBaseChainParams::MAIN);
|
||||
// const Consensus::Params& params = Params().GetConsensus();
|
||||
// const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
|
||||
// int64_t nLastRetargetTime = 1279008237; // Block #66528
|
||||
// CBlockIndex pindexLast;
|
||||
// pindexLast.nHeight = 68543;
|
||||
// pindexLast.nTime = 1279297671; // Block #68543
|
||||
// pindexLast.nBits = 0x1c05a3f4;
|
||||
// BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1c0168fd);
|
||||
// BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1c0168fd);
|
||||
// }
|
||||
|
||||
/* Test the constraint on the upper bound for actual time taken */
|
||||
// BOOST_AUTO_TEST_CASE(get_next_work_upper_limit_actual)
|
||||
// {
|
||||
// SelectParams(CBaseChainParams::MAIN);
|
||||
// const Consensus::Params& params = Params().GetConsensus();
|
||||
// const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
|
||||
// int64_t nLastRetargetTime = 1263163443; // NOTE: Not an actual block time
|
||||
// CBlockIndex pindexLast;
|
||||
// pindexLast.nHeight = 46367;
|
||||
// pindexLast.nTime = 1269211443; // Block #46367
|
||||
// pindexLast.nBits = 0x1c387f6f;
|
||||
// BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00e1fd);
|
||||
// BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00e1fd);
|
||||
// }
|
||||
|
||||
BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test)
|
||||
{
|
||||
SelectParams(CBaseChainParams::MAIN);
|
||||
const Consensus::Params& params = Params().GetConsensus();
|
||||
|
||||
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
std::vector<CBlockIndex> blocks(10000);
|
||||
for (int i = 0; i < 10000; i++) {
|
||||
blocks[i].pprev = i ? &blocks[i - 1] : NULL;
|
||||
blocks[i].nHeight = i;
|
||||
blocks[i].nTime = 1269211443 + i * params.nPowTargetSpacing;
|
||||
blocks[i].nTime = 1269211443 + i * chainParams->GetConsensus().nPowTargetSpacing;
|
||||
blocks[i].nBits = 0x207fffff; /* target 0x7fffff000... */
|
||||
blocks[i].nChainWork = i ? blocks[i - 1].nChainWork + GetBlockProof(blocks[i - 1]) : arith_uint256(0);
|
||||
}
|
||||
@ -203,7 +196,7 @@ BOOST_AUTO_TEST_CASE(GetBlockProofEquivalentTime_test)
|
||||
CBlockIndex *p2 = &blocks[GetRand(10000)];
|
||||
CBlockIndex *p3 = &blocks[GetRand(10000)];
|
||||
|
||||
int64_t tdiff = GetBlockProofEquivalentTime(*p1, *p2, *p3, params);
|
||||
int64_t tdiff = GetBlockProofEquivalentTime(*p1, *p2, *p3, chainParams->GetConsensus());
|
||||
BOOST_CHECK_EQUAL(tdiff, p1->GetBlockTime() - p2->GetBlockTime());
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ BOOST_FIXTURE_TEST_SUITE(subsidy_tests, TestingSetup)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(block_subsidy_test)
|
||||
{
|
||||
const Consensus::Params& consensusParams = Params(CBaseChainParams::MAIN).GetConsensus();
|
||||
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
|
||||
uint32_t nPrevBits;
|
||||
int32_t nPrevHeight;
|
||||
@ -22,43 +22,43 @@ BOOST_AUTO_TEST_CASE(block_subsidy_test)
|
||||
// details for block 4249 (subsidy returned will be for block 4250)
|
||||
nPrevBits = 0x1c4a47c4;
|
||||
nPrevHeight = 4249;
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false);
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
|
||||
BOOST_CHECK_EQUAL(nSubsidy, 50000000000ULL);
|
||||
|
||||
// details for block 4501 (subsidy returned will be for block 4502)
|
||||
nPrevBits = 0x1c4a47c4;
|
||||
nPrevHeight = 4501;
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false);
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
|
||||
BOOST_CHECK_EQUAL(nSubsidy, 5600000000ULL);
|
||||
|
||||
// details for block 5464 (subsidy returned will be for block 5465)
|
||||
nPrevBits = 0x1c29ec00;
|
||||
nPrevHeight = 5464;
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false);
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
|
||||
BOOST_CHECK_EQUAL(nSubsidy, 2100000000ULL);
|
||||
|
||||
// details for block 5465 (subsidy returned will be for block 5466)
|
||||
nPrevBits = 0x1c29ec00;
|
||||
nPrevHeight = 5465;
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false);
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
|
||||
BOOST_CHECK_EQUAL(nSubsidy, 12200000000ULL);
|
||||
|
||||
// details for block 17588 (subsidy returned will be for block 17589)
|
||||
nPrevBits = 0x1c08ba34;
|
||||
nPrevHeight = 17588;
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false);
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
|
||||
BOOST_CHECK_EQUAL(nSubsidy, 6100000000ULL);
|
||||
|
||||
// details for block 99999 (subsidy returned will be for block 100000)
|
||||
nPrevBits = 0x1b10cf42;
|
||||
nPrevHeight = 99999;
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false);
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
|
||||
BOOST_CHECK_EQUAL(nSubsidy, 500000000ULL);
|
||||
|
||||
// details for block 210239 (subsidy returned will be for block 210240)
|
||||
nPrevBits = 0x1b11548e;
|
||||
nPrevHeight = 210239;
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false);
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
|
||||
BOOST_CHECK_EQUAL(nSubsidy, 500000000ULL);
|
||||
|
||||
// 1st subsidy reduction happens here
|
||||
@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE(block_subsidy_test)
|
||||
// details for block 210240 (subsidy returned will be for block 210241)
|
||||
nPrevBits = 0x1b10d50b;
|
||||
nPrevHeight = 210240;
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, consensusParams, false);
|
||||
nSubsidy = GetBlockSubsidy(nPrevBits, nPrevHeight, chainParams->GetConsensus(), false);
|
||||
BOOST_CHECK_EQUAL(nSubsidy, 464285715ULL);
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,8 @@ BOOST_AUTO_TEST_CASE(versionbits_test)
|
||||
}
|
||||
|
||||
// Sanity checks of version bit deployments
|
||||
const Consensus::Params &mainnetParams = Params(CBaseChainParams::MAIN).GetConsensus();
|
||||
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
const Consensus::Params &mainnetParams = chainParams->GetConsensus();
|
||||
for (int i=0; i<(int) Consensus::MAX_VERSION_BITS_DEPLOYMENTS; i++) {
|
||||
uint32_t bitmask = VersionBitsMask(mainnetParams, (Consensus::DeploymentPos)i);
|
||||
// Make sure that no deployment tries to set an invalid bit.
|
||||
@ -235,7 +236,8 @@ BOOST_AUTO_TEST_CASE(versionbits_computeblockversion)
|
||||
{
|
||||
// Check that ComputeBlockVersion will set the appropriate bit correctly
|
||||
// on mainnet.
|
||||
const Consensus::Params &mainnetParams = Params(CBaseChainParams::MAIN).GetConsensus();
|
||||
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
|
||||
const Consensus::Params &mainnetParams = chainParams->GetConsensus();
|
||||
|
||||
// Use the TESTDUMMY deployment for testing purposes.
|
||||
int64_t bit = mainnetParams.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit;
|
||||
|
Loading…
Reference in New Issue
Block a user