Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge bitcoin#13311: Don't edit Chainparams after initialization #4362

Merged
merged 7 commits into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ BITCOIN_CORE_H = \
validation.h \
validationinterface.h \
versionbits.h \
versionbitsinfo.h \
walletinitinterface.h \
wallet/coincontrol.h \
wallet/crypter.h \
Expand Down Expand Up @@ -579,6 +580,7 @@ libdash_common_a_SOURCES = \
script/ismine.cpp \
script/sign.cpp \
script/standard.cpp \
versionbitsinfo.cpp \
warnings.cpp \
$(BITCOIN_CORE_H)

Expand Down
439 changes: 326 additions & 113 deletions src/chainparams.cpp

Large diffs are not rendered by default.

50 changes: 2 additions & 48 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class CChainParams
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
const CCheckpointData& Checkpoints() const { return checkpointData; }
const ChainTxData& TxData() const { return chainTxData; }
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThresholdStart, int64_t nThresholdMin, int64_t nFalloffCoeff);
void UpdateDIP3Parameters(int nActivationHeight, int nEnforcementHeight);
void UpdateDIP8Parameters(int nActivationHeight);
void UpdateBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock);
Expand Down Expand Up @@ -138,7 +137,7 @@ class CChainParams
* @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, bool fHelpOnly = false);
std::unique_ptr<const CChainParams> CreateChainParams(const std::string& chain);

/**
* Return the currently selected parameters. This won't change after app
Expand All @@ -152,49 +151,4 @@ const CChainParams &Params();
*/
void SelectParams(const std::string& chain);

/**
* Allows modifying the Version Bits regtest parameters.
*/
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThresholdStart, int64_t nThresholdMin, int64_t nFalloffCoeff);

/**
* Allows modifying the DIP3 activation and enforcement height
*/
void UpdateDIP3Parameters(int nActivationHeight, int nEnforcementHeight);

/**
* Allows modifying the DIP8 activation height
*/
void UpdateDIP8Parameters(int nActivationHeight);

/**
* Allows modifying the budget regtest parameters.
*/
void UpdateBudgetParameters(int nMasternodePaymentsStartBlock, int nBudgetPaymentsStartBlock, int nSuperblockStartBlock);

/**
* Allows modifying the subsidy and difficulty devnet parameters.
*/
void UpdateDevnetSubsidyAndDiffParams(int nMinimumDifficultyBlocks, int nHighSubsidyBlocks, int nHighSubsidyFactor);

/**
* Allows modifying the LLMQ type for ChainLocks.
*/
void UpdateDevnetLLMQChainLocks(Consensus::LLMQType llmqType);

/**
* Allows modifying the LLMQ type for InstantSend.
*/
void UpdateDevnetLLMQInstantSend(Consensus::LLMQType llmqType);

/**
* Allows modifying parameters of the test LLMQ
*/
void UpdateLLMQTestParams(int size, int threshold);

/**
* Allows modifying parameters of the devnet LLMQ
*/
void UpdateLLMQDevnetParams(int size, int threshold);

#endif // BITCOIN_CHAINPARAMS_H
#endif // BITCOIN_CHAINPARAMS_H
16 changes: 15 additions & 1 deletion src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,24 @@ const std::string CBaseChainParams::REGTEST = "regtest";

void SetupChainParamsBaseOptions()
{
gArgs.AddArg("-budgetparams=<masternode>:<budget>:<superblock>", "Override masternode, budget and superblock start heights (regtest-only)", true, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-devnet=<name>", "Use devnet chain with provided name", false, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-dip3params=<activation>:<enforcement>", "Override DIP3 activation and enforcement heights (regtest-only)", true, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-dip8params=<activation>", "Override DIP8 activation height (regtest-only)", true, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-highsubsidyblocks=<n>", "The number of blocks with a higher than normal subsidy to mine at the start of a chain (default: 0, devnet-only)", false, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-highsubsidyfactor=<n>", "The factor to multiply the normal block subsidy by while in the highsubsidyblocks window of a chain (default: 1, devnet-only)", false, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-llmqchainlocks=<quorum name>", "Override the default LLMQ type used for ChainLocks. Allows using ChainLocks with smaller LLMQs. (default: llmq_50_60, devnet-only)", false, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-llmqdevnetparams=<size>:<threshold>", "Override the default LLMQ size for the LLMQ_DEVNET quorum (default: 3:2, devnet-only)", false, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-llmqinstantsend=<quorum name>", "Override the default LLMQ type used for InstantSend. Allows using InstantSend with smaller LLMQs. (default: llmq_50_60, devnet-only)", false, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-llmqtestparams=<size>:<threshold>", "Override the default LLMQ size for the LLMQ_TEST quorum (default: 10:6, regtest-only)", true, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-minimumdifficultyblocks=<n>", "The number of blocks that can be mined with the minimum difficulty at the start of a chain (default: 0, devnet-only)", false, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-regtest", "Enter regression test mode, which uses a special chain in which blocks can be solved instantly. "
"This is intended for regression testing tools and app development.", true, OptionsCategory::CHAINPARAMS);
"This is intended for regression testing tools and app development.", true, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-testnet", "Use the test chain", false, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-vbparams=<deployment>:<start>:<end>(:<window>:<threshold/thresholdstart>(:<thresholdmin>:<falloffcoeff>))",
"Use given start/end times for specified version bits deployment (regtest-only). "
"Specifying window, threshold/thresholdstart, thresholdmin and falloffcoeff is optional.", true, OptionsCategory::CHAINPARAMS);

}

static std::unique_ptr<CBaseChainParams> globalChainBaseParams;
Expand Down
Loading