witnessScript
shouldn’t be the redeemScript
however it’s analog to it. It’s the precise Script that’s dedicated to by its hash within the output, and executed when spending it. It’s the “Segwit model of the redeemScript
” if you’ll.
CODESEPARATOR
is an (attention-grabbing [1]) OP code which permits to customise the behaviour of the CHECKSIG
OP code. It permits to part the script code for a signature to decide to solely a part of it.
BIP143 barely modified its behaviour for SegWit scripts.
Concerning your final query, if i perceive accurately you might be refering to those feedback within the check vector.
(please be aware that the not-yet-executed OP_CODESEPARATOR shouldn't be faraway from the scriptCode)
all the things as much as the final executed OP_CODESEPARATOR, together with that OP_CODESEPARATOR, are eliminated
These feedback are right here for example the brand new behaviour launched in BIP143. The witness script of the output these signatures are for is the next.
<026dccc749adc2a9d0d89497ac511f760f45c47dc5ed9cf352a58ac706453880ae> CHECKSIGVERIFY CODESEPARATOR <0255a9626aebf5e29c0e6538428ba0d1dcf6ca98ffdf086aa8ced5e0d0215ea465> CHECKSIG
The 2 feedback describe the distinction within the scriptCode
for computing the signature of every public key contained within the witness script.
For the primary one there was no CODESEPARATOR
earlier than the CHECKSIGVERIFY
, due to this fact the scriptCode
is the complete witness Script. For the second nevertheless there was a CODESEPARATOR
executed earlier than the CHECKSIG
, due to this fact the scriptCode
is the a part of the witness script beginning simply after the CODESEPARATOR
as much as the tip.
[1] CODESEPARATOR
was initially used to execute the scriptPubkey and scriptSig as a single stack (inserted in-between). It was then eliminated by Satoshi when patching the 1 RETURN
bug.