aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@chaincode.com>2017-09-12 11:38:20 -0400
committerSuhas Daftuar <sdaftuar@gmail.com>2018-04-13 09:52:50 -0400
commitce650182f4d9847423202789856e6e5f499151f8 (patch)
tree8c8d4fb1e83bb6b8ebb1955f646720a54272158c /src/validation.cpp
parent94deb093499ca72154b794b3005d5cdaa6d97de9 (diff)
Use P2SH consensus rules for all blocks
This commit moves P2SH activation back to the genesis block, with a hardcoded exception for the one historical block in the chain that violated this rule.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index cbbc857fdc..ac585895e5 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1730,8 +1730,15 @@ static unsigned int GetBlockScriptFlags(const CBlockIndex* pindex, const Consens
unsigned int flags = SCRIPT_VERIFY_NONE;
- // Start enforcing P2SH (BIP16)
- if (pindex->nHeight >= consensusparams.BIP16Height) {
+ // BIP16 didn't become active until Apr 1 2012 (on mainnet, and
+ // retroactively applied to testnet)
+ // However, only one historical block violated the P2SH rules (on both
+ // mainnet and testnet), so for simplicity, always leave P2SH
+ // on except for the one violating block.
+ if (consensusparams.BIP16Exception.IsNull() || // no bip16 exception on this chain
+ pindex->phashBlock == nullptr || // this is a new candidate block, eg from TestBlockValidity()
+ *pindex->phashBlock != consensusparams.BIP16Exception) // this block isn't the historical exception
+ {
flags |= SCRIPT_VERIFY_P2SH;
}