From 1ff64d207ee7c0b8ad7a942d307ad750b659bab7 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Wed, 12 Oct 2016 12:13:02 +1100 Subject: [PATCH] TransactionBuilder: flatten prepareInput P2SH detection --- src/transaction_builder.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/transaction_builder.js b/src/transaction_builder.js index 63222df..dbb39af 100644 --- a/src/transaction_builder.js +++ b/src/transaction_builder.js @@ -182,16 +182,12 @@ function prepareInput (input, kpPubKey, redeemScript, hashType) { var expanded = expandOutput(redeemScript, undefined, kpPubKey) if (!expanded.pubKeys) throw new Error('RedeemScript not supported "' + bscript.toASM(redeemScript) + '"') - // if we don't have a prevOutScript, generate a P2SH script - if (!input.prevOutType) { - input.prevOutScript = bscript.scriptHashOutput(redeemScriptHash) - input.prevOutType = 'scripthash' - } - input.pubKeys = expanded.pubKeys + input.signatures = expanded.signatures input.redeemScript = redeemScript input.redeemScriptType = expanded.scriptType - input.signatures = expanded.signatures + input.prevOutScript = input.prevOutScript || bscript.scriptHashOutput(redeemScriptHash) + input.prevOutType = 'scripthash' // maybe we have some prevOut knowledge } else if (input.prevOutType) {