Define hardfork block height. Eliminate PoW blocks beyond this height.

This commit is contained in:
EverGreenCoin 2017-10-26 19:00:31 -04:00
parent ecabec1e6a
commit 3d03cecd38
2 changed files with 7 additions and 0 deletions

View File

@ -2209,6 +2209,9 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot) const
bool CBlock::AcceptBlock() bool CBlock::AcceptBlock()
{ {
// STS check version
if (nVersion > CURRENT_VERSION)
return DoS(100, error("AcceptBlock() : reject unknown block version %d", nVersion));
// Check for duplicate // Check for duplicate
uint256 hash = GetHash(); uint256 hash = GetHash();
if (mapBlockIndex.count(hash)) if (mapBlockIndex.count(hash))
@ -2221,6 +2224,9 @@ bool CBlock::AcceptBlock()
CBlockIndex* pindexPrev = (*mi).second; CBlockIndex* pindexPrev = (*mi).second;
int nHeight = pindexPrev->nHeight+1; 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 // Check proof-of-work or proof-of-stake
if (nBits != GetNextTargetRequired(pindexPrev, IsProofOfStake())) if (nBits != GetNextTargetRequired(pindexPrev, IsProofOfStake()))
return DoS(100, error("AcceptBlock() : incorrect %s", IsProofOfWork() ? "proof-of-work" : "proof-of-stake")); return DoS(100, error("AcceptBlock() : incorrect %s", IsProofOfWork() ? "proof-of-work" : "proof-of-stake"));

View File

@ -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 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 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 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); } 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. // Threshold for nLockTime: below this value it is interpreted as block number, otherwise as UNIX timestamp.