From 6056e7913e0ca24db5868e899cb39bc1991433c2 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Wed, 12 Oct 2016 12:13:27 +1100 Subject: [PATCH] TransactionBuilder: fixMultisigOrder only works if a redeemScript exists --- src/transaction_builder.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/transaction_builder.js b/src/transaction_builder.js index dbb39af..587085d 100644 --- a/src/transaction_builder.js +++ b/src/transaction_builder.js @@ -213,17 +213,12 @@ function prepareInput (input, kpPubKey, redeemScript, hashType) { } function fixMultisigOrder (input, transaction, vin) { - var hashScriptType = input.redeemScriptType || input.prevOutType - if (hashScriptType !== 'multisig') return - - var hashScript = input.redeemScript || input.prevOutScript - if (!hashScript) return - if (!input.pubKeys) return + if (input.redeemScriptType !== 'multisig' || !input.redeemScript) return if (input.pubKeys.length === input.signatures.length) return var unmatched = input.signatures.concat() var hashType = input.hashType || Transaction.SIGHASH_ALL - var hash = transaction.hashForSignature(vin, hashScript, hashType) + var hash = transaction.hashForSignature(vin, input.redeemScript, hashType) input.signatures = input.pubKeys.map(function (pubKey, y) { var keyPair = ECPair.fromPublicKeyBuffer(pubKey)