Skip to content

Commit 798ec35

Browse files
Thomas Kerindcousens
authored andcommitted
set p2sh=true only if redeemScriptType is set
1 parent 912f5d4 commit 798ec35

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/transaction_builder.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,12 +409,15 @@ function buildInput (input, allowIncomplete) {
409409
if (P2SH.indexOf(input.redeemScriptType) === -1 && !allowIncomplete) {
410410
throw new Error('Impossible to sign this type')
411411
}
412-
p2sh = true
412+
413413
if (SIGNABLE.indexOf(input.redeemScriptType) !== -1) {
414414
sig = buildStack(input.redeemScriptType, input.signatures, input.pubKeys, allowIncomplete)
415415
}
416416
// If it wasn't SIGNABLE, it's witness, defer to that
417-
scriptType = input.redeemScriptType
417+
if (input.redeemScriptType) {
418+
p2sh = true
419+
scriptType = input.redeemScriptType
420+
}
418421
}
419422

420423
if (scriptType === bscript.types.P2WPKH) {

0 commit comments

Comments
 (0)