Subject: [Bitcoin-development] BIP 16 changes (list inside)

From: Amir Taaki <[email-masked]>
Date: Sun, 18 Mar 2012 07:04:27 -0700 (PDT)

Hi,

Is this an accurate and precise summary of the changes needed for P2SH and BIP 16?

== Block validation (starting with ProcessBlock) ==

* SigOpCount is now a LegacySigOpCount (CheckBlock)
* Main body of AcceptBlock() and rest of ProcessBlock() is unchanged.
* AddToBlockIndex() unchanged
* Some nice efficient improvements to SetBestChain(), but not related to BIP 16
* ConnectBlock() has new SigOp calculation.
* No important changes to FetchInputs()/ConnectInputs()

== Script ==

* Solver has special case to check for TX_SCRIPTHASH. Returns hash of input eval script
* Another Solver which a) returns signature of pubkey script or b) TX_SCRIPTHASH - finds redeem script in KeyStore and returns it.
* ExtractAddress(es)
* VerifyScript:
** After running input script (scriptSig), copy stack
** Evaluate script as normal
** if block date (fValidatePayToScriptHash) and output script (scriptPubKey) is P2SH:
*** scriptSig must be only push operations
*** evaluate last item of copied stack as a script using the copied stack as the stack
* SigOpCount (used inside CBlock::ConnectBlock main loop) does scoring checksigs and multisigs.
** Newly added DecodeOP_N to normal SigOpCount

== Address ==

* Set main hash160 data with a beginning byte (nVersion) of 0x05