mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-06 21:57:54 +02:00
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.
This commit is contained in:
committed by
Suhas Daftuar
parent
94deb09349
commit
ce650182f4
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user