multisig.input.encodestack - replace OP_0 (permitted by partialSignature) with EMPTY_BUFFER
This commit is contained in:
parent
105a82762c
commit
da49e389c4
2 changed files with 9 additions and 4 deletions
src
|
@ -39,7 +39,12 @@ function encodeStack (signatures, scriptPubKey) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [].concat(EMPTY_BUFFER, signatures)
|
return [].concat(EMPTY_BUFFER, signatures.map(function (sig) {
|
||||||
|
if (sig === OPS.OP_0) {
|
||||||
|
return EMPTY_BUFFER
|
||||||
|
}
|
||||||
|
return sig
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
function encode (signatures, scriptPubKey) {
|
function encode (signatures, scriptPubKey) {
|
||||||
|
|
|
@ -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 || Buffer.from('', 'hex')
|
return signature || ops.OP_0
|
||||||
})
|
})
|
||||||
if (!allowIncomplete) {
|
if (!allowIncomplete) {
|
||||||
// remove blank signatures
|
// remove blank signatures
|
||||||
signatures = signatures.filter(function (x) { return x.length !== 0 })
|
signatures = signatures.filter(function (x) { return x !== ops.OP_0 })
|
||||||
}
|
}
|
||||||
|
|
||||||
return [].concat(Buffer.from('', 'hex'), signatures)
|
return bscript.multisig.input.encodeStack(signatures)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Not yet supported')
|
throw new Error('Not yet supported')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue