Talk:OP CHECKSIG

From Bitcoin Wiki
Revision as of 23:55, 7 February 2012 by Mad (talk | contribs)
Jump to navigation Jump to search

Redundant step?

Under "How it works", we have steps 2 and 6:

- 2. A new subscript is created from the instruction from the most recent OP_CODESEPARATOR to the end of the script. If there is no OP_CODESEPARATOR the entire script becomes the subscript (hereby referred to as subScript)

- 6. All OP_CODESEPARATORS are removed from subScript

However, doesn't step 6 seem redundant? Vegard


Answer: (sirk390) The comment for step 6. in the bitcoin sources help to understand this (script.cpp:882)

      // In case concatenating two scripts ends up with two codeseparators,
      // or an extra one at the end, this prevents all those possible incompatibilities. 

In step 2, only OP_CODESEPARATOR before OP_CHECKSIG are removed. In step OP_CODESEPARATOR after OP_CHECKSIG are also removed.


More info

Maybe add short description from here Contracts#Theory for all SIGHASH_*? Mad