Make skipping BIP30 check chain agnostic
This commit is contained in:
parent
06d81ad516
commit
33c90cf197
@ -73,6 +73,8 @@ public:
|
|||||||
consensus.nMajorityEnforceBlockUpgrade = 750;
|
consensus.nMajorityEnforceBlockUpgrade = 750;
|
||||||
consensus.nMajorityRejectBlockOutdated = 950;
|
consensus.nMajorityRejectBlockOutdated = 950;
|
||||||
consensus.nMajorityWindow = 1000;
|
consensus.nMajorityWindow = 1000;
|
||||||
|
consensus.BIP34Height = 227931;
|
||||||
|
consensus.BIP34Hash = uint256S("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8");
|
||||||
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||||
consensus.nPowTargetSpacing = 10 * 60;
|
consensus.nPowTargetSpacing = 10 * 60;
|
||||||
@ -153,6 +155,8 @@ public:
|
|||||||
consensus.nMajorityEnforceBlockUpgrade = 51;
|
consensus.nMajorityEnforceBlockUpgrade = 51;
|
||||||
consensus.nMajorityRejectBlockOutdated = 75;
|
consensus.nMajorityRejectBlockOutdated = 75;
|
||||||
consensus.nMajorityWindow = 100;
|
consensus.nMajorityWindow = 100;
|
||||||
|
consensus.BIP34Height = 21111;
|
||||||
|
consensus.BIP34Hash = uint256S("0x0000000023b3a96d3484e5abb3755c413e7d41500f8e2a5c3f0dd01299cd8ef8");
|
||||||
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||||
consensus.nPowTargetSpacing = 10 * 60;
|
consensus.nPowTargetSpacing = 10 * 60;
|
||||||
@ -216,6 +220,8 @@ public:
|
|||||||
consensus.nMajorityEnforceBlockUpgrade = 750;
|
consensus.nMajorityEnforceBlockUpgrade = 750;
|
||||||
consensus.nMajorityRejectBlockOutdated = 950;
|
consensus.nMajorityRejectBlockOutdated = 950;
|
||||||
consensus.nMajorityWindow = 1000;
|
consensus.nMajorityWindow = 1000;
|
||||||
|
consensus.BIP34Height = -1; // BIP34 has not necessarily activated on regtest
|
||||||
|
consensus.BIP34Hash = uint256();
|
||||||
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
|
||||||
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
|
||||||
consensus.nPowTargetSpacing = 10 * 60;
|
consensus.nPowTargetSpacing = 10 * 60;
|
||||||
|
@ -19,6 +19,9 @@ struct Params {
|
|||||||
int nMajorityEnforceBlockUpgrade;
|
int nMajorityEnforceBlockUpgrade;
|
||||||
int nMajorityRejectBlockOutdated;
|
int nMajorityRejectBlockOutdated;
|
||||||
int nMajorityWindow;
|
int nMajorityWindow;
|
||||||
|
/** Block height and hash at which BIP34 becomes active */
|
||||||
|
int BIP34Height;
|
||||||
|
uint256 BIP34Hash;
|
||||||
/** Proof of work parameters */
|
/** Proof of work parameters */
|
||||||
uint256 powLimit;
|
uint256 powLimit;
|
||||||
bool fPowAllowMinDifficultyBlocks;
|
bool fPowAllowMinDifficultyBlocks;
|
||||||
|
@ -1742,10 +1742,10 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
// time BIP34 activated, in each of the existing pairs the duplicate coinbase had overwritten the first
|
// time BIP34 activated, in each of the existing pairs the duplicate coinbase had overwritten the first
|
||||||
// before the first had been spent. Since those coinbases are sufficiently buried its no longer possible to create further
|
// before the first had been spent. Since those coinbases are sufficiently buried its no longer possible to create further
|
||||||
// duplicate transactions descending from the known pairs either.
|
// duplicate transactions descending from the known pairs either.
|
||||||
// If we're on the known chain at height greater than 227931 where BIP34 activated, we can save the db accesses needed for the BIP30 check.
|
// If we're on the known chain at height greater than where BIP34 activated, we can save the db accesses needed for the BIP30 check.
|
||||||
CBlockIndex *pindexBIP34height = pindex->pprev->GetAncestor(227931);
|
CBlockIndex *pindexBIP34height = pindex->pprev->GetAncestor(chainparams.GetConsensus().BIP34Height);
|
||||||
//Only continue to enforce if we're below height 227931 or the block hash at that height doesn't correspond.
|
//Only continue to enforce if we're below BIP34 activation height or the block hash at that height doesn't correspond.
|
||||||
fEnforceBIP30 = fEnforceBIP30 && (!pindexBIP34height || !(pindexBIP34height->GetBlockHash() == uint256S("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8")));
|
fEnforceBIP30 = fEnforceBIP30 && (!pindexBIP34height || !(pindexBIP34height->GetBlockHash() == chainparams.GetConsensus().BIP34Hash));
|
||||||
|
|
||||||
if (fEnforceBIP30) {
|
if (fEnforceBIP30) {
|
||||||
BOOST_FOREACH(const CTransaction& tx, block.vtx) {
|
BOOST_FOREACH(const CTransaction& tx, block.vtx) {
|
||||||
|
Loading…
Reference in New Issue
Block a user