LearnBitcoin

Bitcoin Dev Archive 2012

BIP 16 changes (list inside)

2 messages, 18 Mar 2012. Started by Amir Taaki.

Amir Taaki, Luke Dashjr

Permalink Original thread on gnusha.org

Amir Taaki permalink original

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
Luke Dashjr in reply to Amir Taaki permalink original

On Sunday, March 18, 2012 10:04:27 AM Amir Taaki wrote:

Quoted text (2 lines)
> Is this an accurate and precise summary of the changes needed for P2SH and
> BIP 16?
You might find my 0.4.x backport helpful:
    https://github.com/luke-jr/bitcoin/commit/bip16_0.4.x
Be aware, this still needs auditing (nobody else has looked it over), but I
believe should cover only the minimal changes required to get P2SH validation
(though not the "standard" rule changes to accept them into blocks).