From 2d57b561c212a7587aed895792b506807d3923c3 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 5 Jul 2012 21:22:16 -0400 Subject: Reject block.nVersion<=1 blocks if network has upgraded to version=2 If 950 of the last 1,000 blocks are nVersion=2, reject nVersion=1 (or zero, but no bitcoin release has created block.nVersion=0) blocks -- 75 of last 100 on testnet3. This rule is being put in place now so that we don't have to go through another "express support" process to get what we really want, which is for every single new block to include the block height in the coinbase. --- src/main.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index fc57713129..1821576dc5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1554,8 +1554,17 @@ bool CBlock::AcceptBlock() if (!Checkpoints::CheckBlock(nHeight, hash)) return error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight); + // Reject block.nVersion=1 blocks when 95% (75% on testnet) of the network has upgraded: + if (nVersion < 2) + { + if ((!fTestNet && CBlockIndex::IsSuperMajority(2, pindexPrev, 950, 1000)) || + (fTestNet && CBlockIndex::IsSuperMajority(2, pindexPrev, 75, 100))) + { + return error("AcceptBlock() : rejected nVersion=1 block"); + } + } // Enforce block.nVersion=2 rule that the coinbase starts with serialized block height - if (nVersion > 1) + if (nVersion >= 2) { // if 750 of the last 1,000 blocks are version 2 or greater (51/100 if testnet): if ((!fTestNet && CBlockIndex::IsSuperMajority(2, pindexPrev, 750, 1000)) || -- cgit v1.2.3