Skip to content

Commit

Permalink
Version 4 blocks on height 840000
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Dec 29, 2017
1 parent f0c9503 commit a0cf151
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/chainparams.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -178,6 +179,7 @@ class CTestNetParams : public CMainParams {
vAlertPubKey = ParseHex("04e4f58b6a870d4ac13b35ca00f390c674561fea1c161b0c28b34c22ebb34afa5c8d874d12106c34a06c06d20a32d863079a4162003961a88bae4655ebd6a0440f");
checkpointPubKey = "04b0c74b4334f0fd96f09070fbc28dc61a7dc1fbe8988ac98321f45fdd8ce8fed848f04ecaa398bfadb51b5f5adf706e9507f403ab5dce3c57bccf6c3a7db7e7a9";
nNeoScryptHeight = 1;
nBlockVersionChange = 10;
nDefaultPort = 52954;
nEnforceBlockUpgradeMajority = 51;
nRejectBlockOutdatedMajority = 75;
Expand Down
2 changes: 2 additions & 0 deletions src/chainparams.h
Expand Up @@ -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; }
Expand Down Expand Up @@ -93,6 +94,7 @@ class CChainParams
std::string checkpointPubKey;
unsigned int nNeoScryptFork;
int nNeoScryptHeight;
int nBlockVersionChange;
int nDefaultPort;
uint256 bnProofOfWorkLimit;
uint256 bnNeoScryptSwitch;
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions src/miner.cpp
Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions src/primitives/block.h
Expand Up @@ -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;
Expand Down

0 comments on commit a0cf151

Please sign in to comment.