diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2012-07-05 21:22:16 -0400 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2012-08-20 10:46:07 -0400 |
commit | d18f2fd9d6927b1a132c5e0094479cf44fc54aeb (patch) | |
tree | a982774d41cfaca9b0b74fb95272525fb51153f9 /src | |
parent | de237cbfa4c1aa7d4f9888e650f870a50b77de73 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 7a003c0ac5..7dd59fdeaa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1826,8 +1826,17 @@ bool CBlock::AcceptBlock() if (!Checkpoints::CheckBlock(nHeight, hash)) return DoS(100, error("AcceptBlock() : rejected by checkpoint lock-in 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)) || |