From 3d03cecd388b0ea8e3c2157d6b58ff92b79bc734 Mon Sep 17 00:00:00 2001 From: EverGreenCoin Date: Thu, 26 Oct 2017 19:00:31 -0400 Subject: [PATCH] Define hardfork block height. Eliminate PoW blocks beyond this height. --- src/main.cpp | 6 ++++++ src/main.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 4054b72..ba836b7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2209,6 +2209,9 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot) const bool CBlock::AcceptBlock() { + // STS check version + if (nVersion > CURRENT_VERSION) + return DoS(100, error("AcceptBlock() : reject unknown block version %d", nVersion)); // Check for duplicate uint256 hash = GetHash(); if (mapBlockIndex.count(hash)) @@ -2221,6 +2224,9 @@ bool CBlock::AcceptBlock() CBlockIndex* pindexPrev = (*mi).second; int nHeight = pindexPrev->nHeight+1; + if (IsProofOfWork() && nHeight > HF_BLOCK) + return DoS(100, error("AcceptBloock() : rejected pow block at height %d", nHeight)); + // Check proof-of-work or proof-of-stake if (nBits != GetNextTargetRequired(pindexPrev, IsProofOfStake())) return DoS(100, error("AcceptBlock() : incorrect %s", IsProofOfWork() ? "proof-of-work" : "proof-of-stake")); diff --git a/src/main.h b/src/main.h index 4ea33c0..b1e5cb0 100644 --- a/src/main.h +++ b/src/main.h @@ -36,6 +36,7 @@ static const int64 MAX_MINT_PROOF_OF_WORK = 13 * COIN; //Lucky number 13 Coins p static const int64 MAX_MINT_PROOF_OF_STAKE = 0.01 * MAX_MINT_PROOF_OF_WORK; //1% annual interest reward the folders and holders static const int64 MIN_TXOUT_AMOUNT = MIN_TX_FEE; static const unsigned int MAX_TX_COMMENT_LEN = 268; // curecoin: 256 bytes + 12 little extra +static const unsigned int HF_BLOCK = 200000; // hardfork's block height inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } // Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp.