Introduce DIP0001Height (#1973)

Block height at which DIP0001 becomes active

Also drop fDIP0001WasLockedIn
This commit is contained in:
UdjinM6 2018-03-08 15:18:24 +03:00 committed by GitHub
parent 9451782a04
commit 4ffa7bac02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 6 deletions

View File

@ -140,6 +140,7 @@ public:
consensus.BIP34Hash = uint256S("0x000001f35e70f7c5705f64c6c5cc3dea9449e74d5b5c7cf74dad1bcca14a8012"); consensus.BIP34Hash = uint256S("0x000001f35e70f7c5705f64c6c5cc3dea9449e74d5b5c7cf74dad1bcca14a8012");
consensus.BIP65Height = 619382; // 00000000000076d8fcea02ec0963de4abfd01e771fec0863f960c2c64fe6f357 consensus.BIP65Height = 619382; // 00000000000076d8fcea02ec0963de4abfd01e771fec0863f960c2c64fe6f357
consensus.BIP66Height = 245817; // 00000000000b1fa2dfa312863570e13fae9ca7b5566cb27e55422620b469aefa consensus.BIP66Height = 245817; // 00000000000b1fa2dfa312863570e13fae9ca7b5566cb27e55422620b469aefa
consensus.DIP0001Height = 782208;
consensus.powLimit = uint256S("00000fffff000000000000000000000000000000000000000000000000000000"); consensus.powLimit = uint256S("00000fffff000000000000000000000000000000000000000000000000000000");
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
@ -291,6 +292,7 @@ public:
consensus.BIP34Hash = uint256S("0x000008ebb1db2598e897d17275285767717c6acfeac4c73def49fbea1ddcbcb6"); consensus.BIP34Hash = uint256S("0x000008ebb1db2598e897d17275285767717c6acfeac4c73def49fbea1ddcbcb6");
consensus.BIP65Height = 2431; // 0000039cf01242c7f921dcb4806a5994bc003b48c1973ae0c89b67809c2bb2ab consensus.BIP65Height = 2431; // 0000039cf01242c7f921dcb4806a5994bc003b48c1973ae0c89b67809c2bb2ab
consensus.BIP66Height = 2075; // 0000002acdd29a14583540cb72e1c5cc83783560e38fa7081495d474fe1671f7 consensus.BIP66Height = 2075; // 0000002acdd29a14583540cb72e1c5cc83783560e38fa7081495d474fe1671f7
consensus.DIP0001Height = 5500;
consensus.powLimit = uint256S("00000fffff000000000000000000000000000000000000000000000000000000"); consensus.powLimit = uint256S("00000fffff000000000000000000000000000000000000000000000000000000");
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
@ -419,6 +421,7 @@ public:
consensus.BIP34Height = 2; // BIP34 activated immediately on devnet consensus.BIP34Height = 2; // BIP34 activated immediately on devnet
consensus.BIP65Height = 2; // BIP65 activated immediately on devnet consensus.BIP65Height = 2; // BIP65 activated immediately on devnet
consensus.BIP66Height = 2; // BIP66 activated immediately on devnet consensus.BIP66Height = 2; // BIP66 activated immediately on devnet
consensus.DIP0001Height = 2; // DIP0001 activated immediately on devnet
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes
@ -545,6 +548,7 @@ public:
consensus.BIP34Hash = uint256(); consensus.BIP34Hash = uint256();
consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in rpc activation tests) consensus.BIP65Height = 1351; // BIP65 activated on regtest (Used in rpc activation tests)
consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in rpc activation tests) consensus.BIP66Height = 1251; // BIP66 activated on regtest (Used in rpc activation tests)
consensus.DIP0001Height = 2000;
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day consensus.nPowTargetTimespan = 24 * 60 * 60; // Dash: 1 day
consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes consensus.nPowTargetSpacing = 2.5 * 60; // Dash: 2.5 minutes

View File

@ -65,6 +65,8 @@ struct Params {
int BIP65Height; int BIP65Height;
/** Block height at which BIP66 becomes active */ /** Block height at which BIP66 becomes active */
int BIP66Height; int BIP66Height;
/** Block height at which DIP0001 becomes active */
int DIP0001Height;
/** /**
* Minimum blocks including miner confirmation of the total of nMinerConfirmationWindow blocks in a retargeting period, * Minimum blocks including miner confirmation of the total of nMinerConfirmationWindow blocks in a retargeting period,
* (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments. * (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments.

View File

@ -38,7 +38,7 @@ void CDSNotificationInterface::UpdatedBlockTip(const CBlockIndex *pindexNew, con
masternodeSync.UpdatedBlockTip(pindexNew, fInitialDownload, connman); masternodeSync.UpdatedBlockTip(pindexNew, fInitialDownload, connman);
// Update global DIP0001 activation status // Update global DIP0001 activation status
fDIP0001ActiveAtTip = (VersionBitsState(pindexNew, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0001, versionbitscache) == THRESHOLD_ACTIVE); fDIP0001ActiveAtTip = pindexNew->nHeight >= Params().GetConsensus().DIP0001Height;
if (fInitialDownload) if (fInitialDownload)
return; return;

View File

@ -89,7 +89,6 @@ bool fAlerts = DEFAULT_ALERTS;
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE; int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE;
bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT; bool fEnableReplacement = DEFAULT_ENABLE_REPLACEMENT;
std::atomic<bool> fDIP0001WasLockedIn{false};
std::atomic<bool> fDIP0001ActiveAtTip{false}; std::atomic<bool> fDIP0001ActiveAtTip{false};
uint256 hashAssumeValid; uint256 hashAssumeValid;
@ -561,7 +560,8 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state, bool fChe
bool ContextualCheckTransaction(const CTransaction& tx, CValidationState &state, CBlockIndex * const pindexPrev) bool ContextualCheckTransaction(const CTransaction& tx, CValidationState &state, CBlockIndex * const pindexPrev)
{ {
bool fDIP0001Active_context = (VersionBitsState(pindexPrev, Params().GetConsensus(), Consensus::DEPLOYMENT_DIP0001, versionbitscache) == THRESHOLD_ACTIVE); int nHeight = pindexPrev == NULL ? 0 : pindexPrev->nHeight + 1;
bool fDIP0001Active_context = nHeight >= Params().GetConsensus().DIP0001Height;
// Size limits // Size limits
if (fDIP0001Active_context && ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) > MAX_STANDARD_TX_SIZE) if (fDIP0001Active_context && ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) > MAX_STANDARD_TX_SIZE)
@ -2162,7 +2162,7 @@ static bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockInd
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > addressUnspentIndex; std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > addressUnspentIndex;
std::vector<std::pair<CSpentIndexKey, CSpentIndexValue> > spentIndex; std::vector<std::pair<CSpentIndexKey, CSpentIndexValue> > spentIndex;
bool fDIP0001Active_context = (VersionBitsState(pindex->pprev, chainparams.GetConsensus(), Consensus::DEPLOYMENT_DIP0001, versionbitscache) == THRESHOLD_ACTIVE); bool fDIP0001Active_context = pindex->nHeight >= Params().GetConsensus().DIP0001Height;
for (unsigned int i = 0; i < block.vtx.size(); i++) for (unsigned int i = 0; i < block.vtx.size(); i++)
{ {
@ -3432,7 +3432,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, const Co
? pindexPrev->GetMedianTimePast() ? pindexPrev->GetMedianTimePast()
: block.GetBlockTime(); : block.GetBlockTime();
bool fDIP0001Active_context = (VersionBitsState(pindexPrev, consensusParams, Consensus::DEPLOYMENT_DIP0001, versionbitscache) == THRESHOLD_ACTIVE); bool fDIP0001Active_context = nHeight >= Params().GetConsensus().DIP0001Height;
// Size limits // Size limits
unsigned int nMaxBlockSize = MaxBlockSize(fDIP0001Active_context); unsigned int nMaxBlockSize = MaxBlockSize(fDIP0001Active_context);

View File

@ -189,7 +189,6 @@ extern bool fLargeWorkInvalidChainFound;
extern std::map<uint256, int64_t> mapRejectedBlocks; extern std::map<uint256, int64_t> mapRejectedBlocks;
extern std::atomic<bool> fDIP0001WasLockedIn;
extern std::atomic<bool> fDIP0001ActiveAtTip; extern std::atomic<bool> fDIP0001ActiveAtTip;
/** Block hash whose ancestors we will assume to have valid scripts without checking them. */ /** Block hash whose ancestors we will assume to have valid scripts without checking them. */