Skip to content

Commit

Permalink
Update params and logic for asset activation
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptoBLAST committed Mar 29, 2019
1 parent 249a3f7 commit 0bae805
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
20 changes: 10 additions & 10 deletions src/chainparams.cpp
Expand Up @@ -146,6 +146,7 @@ class CMainParams : public CChainParams {
consensus.nMinerConfirmationWindow = 60; // nPowTargetTimespan / nPowTargetSpacing

consensus.nBlockV4UpgradeHeight = 470000; // Miners produce v4 blocks after height 470000
consensus.nBlockVersionRevertHeight = 2000000; // Stop forcing block v4 to allow asset activation

consensus.nAuxPowStartHeight = AuxPow::START_MAINNET;

Expand All @@ -155,7 +156,6 @@ class CMainParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].bit = 6; //Assets (RIP2)
consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].nStartTime = 9999999999; // Oct 31, 2018
consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].nTimeout = 9999999999; // Oct 31, 2019
consensus.nAssetsActivationHeight = 2000000; // Activate assets after height 2000000

// Deployment of BIP68, BIP112, and BIP113.
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
Expand Down Expand Up @@ -290,17 +290,17 @@ class CTestNetParams : public CChainParams {
consensus.nRuleChangeActivationThreshold = 54; // 95% of 60
consensus.nMinerConfirmationWindow = 60; // nPowTargetTimespan / nPowTargetSpacing

consensus.nBlockV4UpgradeHeight = 216; // Miners produce v4 blocks after height 216 (after CSV/SEGWIT activation)

consensus.nBlockV4UpgradeHeight = 200; // Miners produce v4 blocks after height 200 (after CSV/SEGWIT activation at 180)
consensus.nBlockVersionRevertHeight = 300; // Stop forcing block v4 to allow asset activation

consensus.nAuxPowStartHeight = AuxPow::START_TESTNET;

consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008
consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].bit = 6;
consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].nStartTime = 9999999999; // GMT: Sunday, March 17, 2019 12:07:33 AM
consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].nTimeout = 9999999999; // GMT: Tuesday, March 17, 2020 12:07:33 AM
consensus.nAssetsActivationHeight = 672; // Activate assets after height 645
consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].nStartTime = 1553495467; // GMT: Monday, March 25, 2019 6:31:07 AM
consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].nTimeout = 1584403653; // GMT: Tuesday, March 17, 2020 12:07:33 AM

// Deployment of BIP68, BIP112, and BIP113.
consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
Expand Down Expand Up @@ -486,10 +486,11 @@ class CRegTestParams : public CChainParams {

consensus.fPowAllowMinDifficultyBlocks = true;
consensus.fPowNoRetargeting = true;
consensus.nRuleChangeActivationThreshold = 45; // 75% for testchains
consensus.nMinerConfirmationWindow = 60; // Faster than normal for regtest (144 instead of 2016)
consensus.nRuleChangeActivationThreshold = 24; // 75% for testchains
consensus.nMinerConfirmationWindow = 32; // Faster than normal for regtest (32 instead of 60)

consensus.nBlockV4UpgradeHeight = 20; // Miners produce v4 blocks after height 20
consensus.nBlockV4UpgradeHeight = 100; // Miners produce v4 blocks after height 100
consensus.nBlockVersionRevertHeight = 120; // Stop forcing block v4 to allow asset activation

consensus.nAuxPowStartHeight = AuxPow::START_REGTEST;

Expand All @@ -499,7 +500,6 @@ class CRegTestParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].bit = 6;
consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].nStartTime = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_ASSETS].nTimeout = 999999999999ULL;
consensus.nAssetsActivationHeight = 20; // Activate assets after height 10

// The best chain should have at least this much work.
consensus.nMinimumChainWork = uint256S("0x00");
Expand Down
4 changes: 2 additions & 2 deletions src/consensus/params.h
Expand Up @@ -89,8 +89,8 @@ struct Params {
// BLAST: Block v4 Upgrade Height
int nBlockV4UpgradeHeight;

// BLAST: Activate Assets and Deactivate Previous V4 Upgrade Effectss
int nAssetsActivationHeight;
// BLAST: Activate Assets and Deactivate Previous V4 Upgrade Effects
int nBlockVersionRevertHeight;
};
} // namespace Consensus

Expand Down
2 changes: 1 addition & 1 deletion src/miner.cpp
Expand Up @@ -144,7 +144,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
const int32_t nChainId = chainparams.GetConsensus().nAuxpowChainId;
const int32_t nnChainId = (nHeight > chainparams.GetConsensus().nChainIdUpgradeHeight) ? chainparams.GetConsensus().nAlternateChainId : nChainId;
const int32_t nVersion = ComputeBlockVersion(pindexPrev, chainparams.GetConsensus());
const uint32_t nnVersion = (nHeight > chainparams.GetConsensus().nBlockV4UpgradeHeight && nHeight < chainparams.GetConsensus().nAssetsActivationHeight) ? 4 : nVersion;
const uint32_t nnVersion = (nHeight > chainparams.GetConsensus().nBlockV4UpgradeHeight && nHeight < chainparams.GetConsensus().nBlockVersionRevertHeight) ? 4 : nVersion;
pblock->SetBaseVersion(nnVersion, nnChainId);

// -regtest only: allow overriding block.nVersion with
Expand Down
7 changes: 3 additions & 4 deletions src/validation.cpp
Expand Up @@ -3869,7 +3869,7 @@ static bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationSta
strprintf("rejected nVersion=0x%08x block", version - 1));

// Reject outdated version blocks onces assets are active.
if (AreAssetsDeployed() && block.nVersion < VERSIONBITS_TOP_BITS_ASSETS && nHeight < consensusParams.nBlockV4UpgradeHeight && nHeight > consensusParams.nAssetsActivationHeight)
if (AreAssetsDeployed() && block.nVersion < VERSIONBITS_TOP_BITS_ASSETS && nHeight < consensusParams.nBlockV4UpgradeHeight && nHeight > consensusParams.nBlockVersionRevertHeight)
return state.Invalid(false, REJECT_OBSOLETE, strprintf("bad-version(0x%08x)", block.nVersion), strprintf("rejected nVersion=0x%08x block, height= %i", nHeight));

return true;
Expand Down Expand Up @@ -5438,9 +5438,8 @@ bool AreAssetsDeployed() {
if (fAssetsIsActive)
return true;

// const ThresholdState thresholdState = VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_ASSETS);
//if (thresholdState == THRESHOLD_ACTIVE)
//if (nBlockNumber >= Params().nAssetsActivationHeight)
const ThresholdState thresholdState = VersionBitsTipState(Params().GetConsensus(), Consensus::DEPLOYMENT_ASSETS);
if (thresholdState == THRESHOLD_ACTIVE)
fAssetsIsActive = true;

return fAssetsIsActive;
Expand Down
4 changes: 2 additions & 2 deletions src/versionbits.cpp
Expand Up @@ -12,15 +12,15 @@ const struct VBDeploymentInfo VersionBitsDeploymentInfo[Consensus::MAX_VERSION_B
/*.gbt_force =*/ true,
},
{
/*.name =*/ "csv",
/*.name =*/ "assets",
/*.gbt_force =*/ true,
},
{
/*.name =*/ "segwit",
/*.gbt_force =*/ true,
},
{
/*.name =*/ "assets",
/*.name =*/ "csv",
/*.gbt_force =*/ true,
}
};
Expand Down

0 comments on commit 0bae805

Please sign in to comment.