aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2012-07-05 21:22:16 -0400
committerLuke Dashjr <luke-jr+git@utopios.org>2012-08-26 21:07:08 +0000
commit2d57b561c212a7587aed895792b506807d3923c3 (patch)
treeb155370389d68152c1c4606db51e43d2ea4a3538 /src/main.cpp
parent9adab76e0ae07d33d661c7b51b8f89cbfb119870 (diff)
downloadbitcoin-2d57b561c212a7587aed895792b506807d3923c3.tar.xz
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/main.cpp')
-rw-r--r--src/main.cpp11
1 files changed, 10 insertions, 1 deletions
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)) ||