diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 55b15b475..94e02c610 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -105,6 +105,7 @@ class CMainParams : public CChainParams { checkpointPubKey = "04c1e0b0db27b846cd9b8f151904f7edfc2dfaf6f062471f8f86fc23418e0a23f2551e34b02642c79bfeb75755d23d5194243b73318ce35eace6e6042ec399b37c"; nNeoScryptHeight = 120000; nNeoScryptFork = 1414482565; + nBlockVersionChange = 840000; nDefaultPort = 42954; bnProofOfWorkLimit = ~uint256(0) >> 20; bnNeoScryptSwitch = ~uint256(0) >> 28; @@ -178,6 +179,7 @@ class CTestNetParams : public CMainParams { vAlertPubKey = ParseHex("04e4f58b6a870d4ac13b35ca00f390c674561fea1c161b0c28b34c22ebb34afa5c8d874d12106c34a06c06d20a32d863079a4162003961a88bae4655ebd6a0440f"); checkpointPubKey = "04b0c74b4334f0fd96f09070fbc28dc61a7dc1fbe8988ac98321f45fdd8ce8fed848f04ecaa398bfadb51b5f5adf706e9507f403ab5dce3c57bccf6c3a7db7e7a9"; nNeoScryptHeight = 1; + nBlockVersionChange = 10; nDefaultPort = 52954; nEnforceBlockUpgradeMajority = 51; nRejectBlockOutdatedMajority = 75; diff --git a/src/chainparams.h b/src/chainparams.h index 678809f67..e96053077 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -47,6 +47,7 @@ class CChainParams const std::string CheckpointKey() const { return checkpointPubKey;} unsigned int NeoScryptFork() const { return nNeoScryptFork;} int NeoScryptHeight() const { return nNeoScryptHeight;} + int BlockVersionChange() const { return nBlockVersionChange;} int GetDefaultPort() const { return nDefaultPort; } const uint256& ProofOfWorkLimit() const { return bnProofOfWorkLimit; } const uint256& NeoScryptWorkLimit() const { return bnNeoScryptSwitch; } @@ -93,6 +94,7 @@ class CChainParams std::string checkpointPubKey; unsigned int nNeoScryptFork; int nNeoScryptHeight; + int nBlockVersionChange; int nDefaultPort; uint256 bnProofOfWorkLimit; uint256 bnNeoScryptSwitch; diff --git a/src/main.cpp b/src/main.cpp index 478fbc5b8..b39e7859f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1911,12 +1911,12 @@ void static UpdateTip(CBlockIndex *pindexNew) { const CBlockIndex* pindex = chainActive.Tip(); for (int i = 0; i < 100 && pindex != NULL; i++) { - if (pindex->nVersion > CBlock::CURRENT_VERSION) + if (pindex->nVersion > CBlock::NEW_VERSION) ++nUpgraded; pindex = pindex->pprev; } if (nUpgraded > 0) - LogPrintf("SetBestChain: %d of last 100 blocks above version %d\n", nUpgraded, (int)CBlock::CURRENT_VERSION); + LogPrintf("SetBestChain: %d of last 100 blocks above version %d\n", nUpgraded, (int)CBlock::NEW_VERSION); if (nUpgraded > 100/2) { // strMiscWarning is read by GetWarnings(), called by Qt and the JSON-RPC code to warn the user: diff --git a/src/miner.cpp b/src/miner.cpp index 656be607b..9ac9f7d76 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -97,6 +97,10 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) return NULL; CBlock *pblock = &pblocktemplate->block; // pointer for convenience + // Set block version to 4 after BlockVersionChange + if (chainActive.Tip()->nHeight + 1 >= Params().BlockVersionChange()) + pblock->nVersion = CBlockHeader::NEW_VERSION; + // -regtest only: allow overriding block.nVersion with // -blockversion=N to test forking scenarios if (Params().MineBlocksOnDemand()) diff --git a/src/primitives/block.h b/src/primitives/block.h index dc9c1a098..ec91c8f42 100644 --- a/src/primitives/block.h +++ b/src/primitives/block.h @@ -25,6 +25,7 @@ class CBlockHeader public: // header static const int32_t CURRENT_VERSION=2; + static const int32_t NEW_VERSION=4; int32_t nVersion; uint256 hashPrevBlock; uint256 hashMerkleRoot;