aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Lodder <[email protected]>2015-08-10 10:45:16 +0200
committerRoss Nicoll <[email protected]>2015-10-18 13:28:59 +0000
commit288fc013bab3d16b827de6bcc0be077e8cff7f6a (patch)
tree1184b454b866b0f36cf2fa292f92cf76f969eab2
parentReject version 1 blocks with version 3 supermajority (diff)
downloaddiscoin-288fc013bab3d16b827de6bcc0be077e8cff7f6a.tar.xz
discoin-288fc013bab3d16b827de6bcc0be077e8cff7f6a.zip
Use the same time-based constraints as in 1.10
Backport of #1225 to 1.8.x, sets: - majority window to 2000 blocks on mainnet, 1000 on testnet - enforcement triggers to 1500 on mainnet, 501 on testnet - reject triggers to 1900 on mainnet, 750 on testnet
-rw-r--r--src/main.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f34b037d8..1b51e4968 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1967,8 +1967,8 @@ bool ConnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex, C
(fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE);
if (block.GetBaseVersion() >= 3 &&
- ((!TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 750, 1000)) ||
- (TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 51, 100)))) {
+ ((!TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 1500, 2000)) ||
+ (TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 501, 1000)))) {
flags |= SCRIPT_VERIFY_DERSIG;
}
@@ -2717,8 +2717,8 @@ bool AcceptBlockHeader(CBlockHeader& block, CValidationState& state, CBlockIndex
// was hard-disabled until now
if (block.GetBaseVersion() < 2)
{
- if ((!TestNet() && CBlockIndex::IsSuperMajority(3, pindexPrev, 950, 1000)) ||
- (TestNet() && CBlockIndex::IsSuperMajority(3, pindexPrev, 75, 100)))
+ if ((!TestNet() && CBlockIndex::IsSuperMajority(3, pindexPrev, 1900, 2000)) ||
+ (TestNet() && CBlockIndex::IsSuperMajority(3, pindexPrev, 750, 1000)))
{
return state.Invalid(error("AcceptBlock() : rejected nVersion=1 block"),
REJECT_OBSOLETE, "bad-version");
@@ -2766,8 +2766,8 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CBlockIndex** ppindex,
// Reject block.nVersion=2 blocks when 95% (75% on testnet) of the network has upgraded:
if (block.GetBaseVersion() < 3)
{
- if ((!TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 950, 1000)) ||
- (TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 75, 100)))
+ if ((!TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 1900, 2000)) ||
+ (TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 750, 1000)))
{
return state.Invalid(error("AcceptBlock() : rejected nVersion=2 block"),
REJECT_OBSOLETE, "bad-version");
@@ -2779,8 +2779,8 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CBlockIndex** ppindex,
if (block.GetBaseVersion() >= 2)
{
// if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet):
- if ((!TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 750, 1000)) ||
- (TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 51, 100)))
+ if ((!TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 1500, 2000)) ||
+ (TestNet() && CBlockIndex::IsSuperMajority(3, pindex->pprev, 501, 1000)))
{
CScript expect = CScript() << nHeight;
if (block.vtx[0].vin[0].scriptSig.size() < expect.size() ||