buildstack - don't return op_0

This commit is contained in:
Thomas Kerin 2017-09-06 14:14:34 +02:00 committed by Daniel Cousens
parent 7563d8f74a
commit 105a82762c

View file

@ -389,14 +389,14 @@ function buildStack (type, signatures, pubKeys, allowIncomplete) {
} else if (type === scriptTypes.MULTISIG) { } else if (type === scriptTypes.MULTISIG) {
if (signatures.length > 0) { if (signatures.length > 0) {
signatures = signatures.map(function (signature) { signatures = signatures.map(function (signature) {
return signature || ops.OP_0 return signature || Buffer.from('', 'hex')
}) })
if (!allowIncomplete) { if (!allowIncomplete) {
// remove blank signatures // remove blank signatures
signatures = signatures.filter(function (x) { return x !== ops.OP_0 }) signatures = signatures.filter(function (x) { return x.length !== 0 })
} }
return bscript.multisig.input.encodeStack(signatures /* see if it's necessary first */) return [].concat(Buffer.from('', 'hex'), signatures)
} }
} else { } else {
throw new Error('Not yet supported') throw new Error('Not yet supported')
@ -463,7 +463,7 @@ function buildInput (input, allowIncomplete) {
return { return {
type: scriptType, type: scriptType,
script: bscript.compile(sig), script: bscript.compile(sig),
witness: bscript.toStack(witness) witness: witness
} }
} }