From 798ec3512c9bd46b84072a01e92d3fb0f78b2184 Mon Sep 17 00:00:00 2001 From: Thomas Kerin Date: Mon, 7 Aug 2017 15:18:42 +0200 Subject: [PATCH] set p2sh=true only if redeemScriptType is set --- src/transaction_builder.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/transaction_builder.js b/src/transaction_builder.js index e7bf3c3..45d8022 100644 --- a/src/transaction_builder.js +++ b/src/transaction_builder.js @@ -409,12 +409,15 @@ function buildInput (input, allowIncomplete) { if (P2SH.indexOf(input.redeemScriptType) === -1 && !allowIncomplete) { throw new Error('Impossible to sign this type') } - p2sh = true + if (SIGNABLE.indexOf(input.redeemScriptType) !== -1) { sig = buildStack(input.redeemScriptType, input.signatures, input.pubKeys, allowIncomplete) } // If it wasn't SIGNABLE, it's witness, defer to that - scriptType = input.redeemScriptType + if (input.redeemScriptType) { + p2sh = true + scriptType = input.redeemScriptType + } } if (scriptType === bscript.types.P2WPKH) {