TransactionBuilder: fix P2WPKH not using a P2PKH signScript for P2WPKH
This commit is contained in:
parent
5e91c83e0a
commit
74756ed597
1 changed files with 11 additions and 6 deletions
|
@ -233,10 +233,10 @@ function prepareInput (input, ourPubKey, redeemScript, witnessValue, witnessScri
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
redeemScript: redeemScript,
|
redeemScript,
|
||||||
redeemScriptType: SCRIPT_TYPES.P2WSH,
|
redeemScriptType: SCRIPT_TYPES.P2WSH,
|
||||||
|
|
||||||
witnessScript: witnessScript,
|
witnessScript,
|
||||||
witnessScriptType: expanded.type,
|
witnessScriptType: expanded.type,
|
||||||
|
|
||||||
prevOutType: SCRIPT_TYPES.P2SH,
|
prevOutType: SCRIPT_TYPES.P2SH,
|
||||||
|
@ -274,14 +274,14 @@ function prepareInput (input, ourPubKey, redeemScript, witnessValue, witnessScri
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
redeemScript: redeemScript,
|
redeemScript,
|
||||||
redeemScriptType: expanded.type,
|
redeemScriptType: expanded.type,
|
||||||
|
|
||||||
prevOutType: SCRIPT_TYPES.P2SH,
|
prevOutType: SCRIPT_TYPES.P2SH,
|
||||||
prevOutScript: p2sh.output,
|
prevOutScript: p2sh.output,
|
||||||
|
|
||||||
hasWitness: expanded.type === SCRIPT_TYPES.P2WPKH,
|
hasWitness: expanded.type === SCRIPT_TYPES.P2WPKH,
|
||||||
signScript: signScript,
|
signScript,
|
||||||
signType: expanded.type,
|
signType: expanded.type,
|
||||||
|
|
||||||
pubkeys: expanded.pubkeys,
|
pubkeys: expanded.pubkeys,
|
||||||
|
@ -304,7 +304,7 @@ function prepareInput (input, ourPubKey, redeemScript, witnessValue, witnessScri
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
witnessScript: witnessScript,
|
witnessScript,
|
||||||
witnessScriptType: expanded.type,
|
witnessScriptType: expanded.type,
|
||||||
|
|
||||||
prevOutType: SCRIPT_TYPES.P2WSH,
|
prevOutType: SCRIPT_TYPES.P2WSH,
|
||||||
|
@ -331,12 +331,17 @@ function prepareInput (input, ourPubKey, redeemScript, witnessValue, witnessScri
|
||||||
expanded.signatures = input.signatures
|
expanded.signatures = input.signatures
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let signScript = input.prevOutScript
|
||||||
|
if (expanded.type === SCRIPT_TYPES.P2WPKH) {
|
||||||
|
signScript = payments.p2pkh({ pubkey: expanded.pubkeys[0] }).output
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
prevOutType: expanded.type,
|
prevOutType: expanded.type,
|
||||||
prevOutScript: input.prevOutScript,
|
prevOutScript: input.prevOutScript,
|
||||||
|
|
||||||
hasWitness: expanded.type === SCRIPT_TYPES.P2WPKH,
|
hasWitness: expanded.type === SCRIPT_TYPES.P2WPKH,
|
||||||
signScript: input.prevOutScript,
|
signScript,
|
||||||
signType: expanded.type,
|
signType: expanded.type,
|
||||||
|
|
||||||
pubkeys: expanded.pubkeys,
|
pubkeys: expanded.pubkeys,
|
||||||
|
|
Loading…
Add table
Reference in a new issue