It seems that a scriptPubKey used when signing a transaction was wrong.
Fix error in scriptPubKey field in BIP 143 example #652
pull Sword-Smith wants to merge 1 commits into bitcoin:master from Sword-Smith:patch-1 changing 1 files +5 −5-
Sword-Smith commented at 2:08 PM on February 21, 2018: none
-
2b8be46220
Fix error in scriptPubKey field in BIP 143 example
It seems that a scriptPubKey used when signing a transaction was wrong.
- luke-jr added the label Proposed BIP modification on Feb 22, 2018
-
ysangkok commented at 5:47 PM on July 25, 2019: contributor
@Sword-Smith Do you have some code that you use to test this?
-
Sword-Smith commented at 9:29 PM on July 25, 2019: none
@Sword-Smith Do you have some code that you use to test this?
I do not at the moment. But it is obvious, no? You are using BIP143 which is only used when spending segwit inputs. Agreed? So the scriptCode of the input I am spending must be of form P2WPKH or P2WSH in order for BIP143 to be used. Agreed?
The field in question is field 5:
5. scriptCode of the input (serialized as scripts inside CTxOuts)So we are signing a scriptPubKey of something sent to a segwit address. That output must be of the form 0014 (P2WPKH) or 0020 (P2WSH).
Or am I missing something?
-
sipa commented at 9:39 PM on July 25, 2019: member
This is incorrect. The
scriptCodeis the script being executed. It is not the scriptPubKey. For P2SH it is the redeemscript, for P2WSH (P2SH or not) it is the witness script. For P2WPKH (P2SH or not) it is the equivalent P2PKH script. - luke-jr closed this on Sep 19, 2019