mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-09-09 05:12:06 +00:00
Litecoin: Reject v1 blocks at specific block height
This commit is contained in:
parent
3db030f6f4
commit
f6cc96084f
23
src/main.cpp
23
src/main.cpp
@ -3543,8 +3543,29 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
|
||||
if (block.GetBlockTime() > nAdjustedTime + 2 * 60 * 60)
|
||||
return state.Invalid(false, REJECT_INVALID, "time-too-new", "block timestamp too far in the future");
|
||||
|
||||
// Litecoin: Reject block.nVersion=1 blocks (mainnet >= 710000, testnet >= 400000, regtest uses supermajority)
|
||||
const int nHeight = pindexPrev->nHeight+1;
|
||||
bool enforceV2 = false;
|
||||
if (block.nVersion < 2) {
|
||||
if (consensusParams.BIP34Height != -1) {
|
||||
// Mainnet 710k, Testnet 400k
|
||||
if (nHeight >= consensusParams.BIP34Height)
|
||||
enforceV2 = true;
|
||||
}
|
||||
else {
|
||||
// Regtest and Unittest: use Bitcoin's supermajority rule
|
||||
if (IsSuperMajority(2, pindexPrev, consensusParams.nMajorityRejectBlockOutdated, consensusParams))
|
||||
enforceV2 = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (enforceV2) {
|
||||
return state.Invalid(false, REJECT_OBSOLETE, strprintf("bad-version(0x%08x)", block.nVersion),
|
||||
strprintf("rejected nVersion=0x%08x block", block.nVersion));
|
||||
}
|
||||
|
||||
// Reject outdated version blocks when 95% (75% on testnet) of the network has upgraded:
|
||||
for (int32_t version = 2; version < 5; ++version) // check for version 2, 3 and 4 upgrades
|
||||
for (int32_t version = 3; version < 5; ++version) // check for version 2, 3 and 4 upgrades
|
||||
if (block.nVersion < version && IsSuperMajority(version, pindexPrev, consensusParams.nMajorityRejectBlockOutdated, consensusParams))
|
||||
return state.Invalid(false, REJECT_OBSOLETE, strprintf("bad-version(0x%08x)", version - 1),
|
||||
strprintf("rejected nVersion=0x%08x block", version - 1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user