TransactionBuilder: fixMultisigOrder only works if a redeemScript exists
This commit is contained in:
parent
1ff64d207e
commit
6056e7913e
1 changed files with 2 additions and 7 deletions
|
@ -213,17 +213,12 @@ function prepareInput (input, kpPubKey, redeemScript, hashType) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function fixMultisigOrder (input, transaction, vin) {
|
function fixMultisigOrder (input, transaction, vin) {
|
||||||
var hashScriptType = input.redeemScriptType || input.prevOutType
|
if (input.redeemScriptType !== 'multisig' || !input.redeemScript) return
|
||||||
if (hashScriptType !== 'multisig') return
|
|
||||||
|
|
||||||
var hashScript = input.redeemScript || input.prevOutScript
|
|
||||||
if (!hashScript) return
|
|
||||||
if (!input.pubKeys) return
|
|
||||||
if (input.pubKeys.length === input.signatures.length) return
|
if (input.pubKeys.length === input.signatures.length) return
|
||||||
|
|
||||||
var unmatched = input.signatures.concat()
|
var unmatched = input.signatures.concat()
|
||||||
var hashType = input.hashType || Transaction.SIGHASH_ALL
|
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) {
|
input.signatures = input.pubKeys.map(function (pubKey, y) {
|
||||||
var keyPair = ECPair.fromPublicKeyBuffer(pubKey)
|
var keyPair = ECPair.fromPublicKeyBuffer(pubKey)
|
||||||
|
|
Loading…
Reference in a new issue