mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #10463: Names: BIP9 vs versionbits
b463bc9
scripted-diff: s/BIP9DeploymentInfo/VBDeploymentInfo/ (Jorge Timón)29c0719
Rename -bip9params to -vbparams (shaolinfry) Tree-SHA512: a8a2bf6e24a4a7fc82f784c78c0cd92472e9ba55ce3fb22dafef3eccdcfccb2da5a6078fbeec1a8a4b6ab1f1b226976c5aba964dd5e3d029a21b109a7c044374
This commit is contained in:
parent
37659cd522
commit
42985c31bb
@ -83,7 +83,7 @@ static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits
|
||||
}
|
||||
|
||||
|
||||
void CChainParams::UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold)
|
||||
void CChainParams::UpdateVersionBitsParameters(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;
|
||||
@ -877,9 +877,9 @@ void SelectParams(const std::string& network)
|
||||
globalChainParams = CreateChainParams(network);
|
||||
}
|
||||
|
||||
void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold)
|
||||
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold)
|
||||
{
|
||||
globalChainParams->UpdateBIP9Parameters(d, nStartTime, nTimeout, nWindowSize, nThreshold);
|
||||
globalChainParams->UpdateVersionBitsParameters(d, nStartTime, nTimeout, nWindowSize, nThreshold);
|
||||
}
|
||||
|
||||
void UpdateDIP3Parameters(int nActivationHeight, int nEnforcementHeight)
|
||||
|
@ -84,7 +84,7 @@ 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 UpdateVersionBitsParameters(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; }
|
||||
@ -143,9 +143,9 @@ const CChainParams &Params();
|
||||
void SelectParams(const std::string& chain);
|
||||
|
||||
/**
|
||||
* Allows modifying the BIP9 regtest parameters.
|
||||
* Allows modifying the Version Bits regtest parameters.
|
||||
*/
|
||||
void UpdateBIP9Parameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold);
|
||||
void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout, int64_t nWindowSize, int64_t nThreshold);
|
||||
|
||||
/**
|
||||
* Allows modifying the DIP3 activation and enforcement height
|
||||
|
16
src/init.cpp
16
src/init.cpp
@ -566,7 +566,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
||||
strUsage += HelpMessageOpt("-limitancestorsize=<n>", strprintf("Do not accept transactions whose size with all in-mempool ancestors exceeds <n> kilobytes (default: %u)", DEFAULT_ANCESTOR_SIZE_LIMIT));
|
||||
strUsage += HelpMessageOpt("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT));
|
||||
strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT));
|
||||
strUsage += HelpMessageOpt("-bip9params=<deployment>:<start>:<end>(:<window>:<threshold>)", "Use given start/end times for specified BIP9 deployment (regtest-only). Specifying window and threshold is optional.");
|
||||
strUsage += HelpMessageOpt("-vbparams=<deployment>:<start>:<end>(:<window>:<threshold>)", "Use given start/end times for specified version bits deployment (regtest-only). Specifying window and threshold is optional.");
|
||||
strUsage += HelpMessageOpt("-watchquorums=<n>", strprintf("Watch and validate quorum communication (default: %u)", llmq::DEFAULT_WATCH_QUORUMS));
|
||||
}
|
||||
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
|
||||
@ -1326,16 +1326,16 @@ bool AppInitParameterInteraction()
|
||||
|
||||
nMaxTipAge = gArgs.GetArg("-maxtipage", DEFAULT_MAX_TIP_AGE);
|
||||
|
||||
if (gArgs.IsArgSet("-bip9params")) {
|
||||
// Allow overriding BIP9 parameters for testing
|
||||
if (gArgs.IsArgSet("-vbparams")) {
|
||||
// Allow overriding version bits parameters for testing
|
||||
if (!chainparams.MineBlocksOnDemand()) {
|
||||
return InitError("BIP9 parameters may only be overridden on regtest.");
|
||||
return InitError("Version bits parameters may only be overridden on regtest.");
|
||||
}
|
||||
for (const std::string& strDeployment : gArgs.GetArgs("-bip9params")) {
|
||||
for (const std::string& strDeployment : gArgs.GetArgs("-vbparams")) {
|
||||
std::vector<std::string> vDeploymentParams;
|
||||
boost::split(vDeploymentParams, strDeployment, boost::is_any_of(":"));
|
||||
if (vDeploymentParams.size() != 3 && vDeploymentParams.size() != 5) {
|
||||
return InitError("BIP9 parameters malformed, expecting deployment:start:end or deployment:start:end:window:threshold");
|
||||
return InitError("Version bits parameters malformed, expecting deployment:start:end or deployment:start:end:window:threshold");
|
||||
}
|
||||
int64_t nStartTime, nTimeout, nWindowSize = -1, nThreshold = -1;
|
||||
if (!ParseInt64(vDeploymentParams[1], &nStartTime)) {
|
||||
@ -1356,9 +1356,9 @@ bool AppInitParameterInteraction()
|
||||
for (int j=0; j<(int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j)
|
||||
{
|
||||
if (vDeploymentParams[0].compare(VersionBitsDeploymentInfo[j].name) == 0) {
|
||||
UpdateBIP9Parameters(Consensus::DeploymentPos(j), nStartTime, nTimeout, nWindowSize, nThreshold);
|
||||
UpdateVersionBitsParameters(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);
|
||||
LogPrintf("Setting version bits activation parameters for %s to start=%ld, timeout=%ld, window=%ld, threshold=%ld\n", vDeploymentParams[0], nStartTime, nTimeout, nWindowSize, nThreshold);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ static UniValue BIP22ValidationResult(const CValidationState& state)
|
||||
}
|
||||
|
||||
std::string gbt_vb_name(const Consensus::DeploymentPos pos) {
|
||||
const struct BIP9DeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
||||
const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
||||
std::string s = vbinfo.name;
|
||||
if (!vbinfo.gbt_force) {
|
||||
s.insert(s.begin(), '!');
|
||||
@ -648,7 +648,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
||||
// FALL THROUGH to get vbavailable set...
|
||||
case THRESHOLD_STARTED:
|
||||
{
|
||||
const struct BIP9DeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
||||
const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
||||
vbavailable.push_back(Pair(gbt_vb_name(pos), consensusParams.vDeployments[pos].bit));
|
||||
if (setClientRules.find(vbinfo.name) == setClientRules.end()) {
|
||||
if (!vbinfo.gbt_force) {
|
||||
@ -661,7 +661,7 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
||||
case THRESHOLD_ACTIVE:
|
||||
{
|
||||
// Add to rules only
|
||||
const struct BIP9DeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
||||
const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
||||
aRules.push_back(gbt_vb_name(pos));
|
||||
if (setClientRules.find(vbinfo.name) == setClientRules.end()) {
|
||||
// Not supported by the client; make sure it's safe to proceed
|
||||
|
@ -1860,7 +1860,7 @@ int32_t ComputeBlockVersion(const CBlockIndex* pindexPrev, const Consensus::Para
|
||||
for (int i = 0; i < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; i++) {
|
||||
Consensus::DeploymentPos pos = Consensus::DeploymentPos(i);
|
||||
ThresholdState state = VersionBitsState(pindexPrev, params, pos, versionbitscache);
|
||||
const struct BIP9DeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
||||
const struct VBDeploymentInfo& vbinfo = VersionBitsDeploymentInfo[pos];
|
||||
if (vbinfo.check_mn_protocol && state == THRESHOLD_STARTED && fCheckMasternodesUpgraded) {
|
||||
// TODO implement new logic for MN upgrade checks (e.g. with LLMQ based feature/version voting)
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "versionbits.h"
|
||||
#include "consensus/params.h"
|
||||
|
||||
const struct BIP9DeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS] = {
|
||||
const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_BITS_DEPLOYMENTS] = {
|
||||
{
|
||||
/*.name =*/ "testdummy",
|
||||
/*.gbt_force =*/ true,
|
||||
|
@ -30,7 +30,7 @@ enum ThresholdState {
|
||||
// will either be NULL or a block with (height + 1) % Period() == 0.
|
||||
typedef std::map<const CBlockIndex*, ThresholdState> ThresholdConditionCache;
|
||||
|
||||
struct BIP9DeploymentInfo {
|
||||
struct VBDeploymentInfo {
|
||||
/** Deployment name */
|
||||
const char *name;
|
||||
/** Whether GBT clients can safely ignore this rule in simplified usage */
|
||||
@ -47,7 +47,7 @@ struct BIP9Stats {
|
||||
bool possible;
|
||||
};
|
||||
|
||||
extern const struct BIP9DeploymentInfo VersionBitsDeploymentInfo[];
|
||||
extern const struct VBDeploymentInfo VersionBitsDeploymentInfo[];
|
||||
|
||||
/**
|
||||
* Abstract class that implements BIP9-style threshold logic, and caches results.
|
||||
|
Loading…
Reference in New Issue
Block a user