fix isMultisigOutput
This commit is contained in:
parent
85a399d46b
commit
eae8bcf676
2 changed files with 5 additions and 3 deletions
|
@ -225,12 +225,10 @@ function isMultisigOutput (script) {
|
|||
if (chunks[chunks.length - 1] !== OPS.OP_CHECKMULTISIG) return false
|
||||
|
||||
var mOp = chunks[0]
|
||||
if (mOp === OPS.OP_0) return false
|
||||
if (mOp < OPS.OP_1) return false
|
||||
if (mOp > OPS.OP_16) return false
|
||||
|
||||
var nOp = chunks[chunks.length - 2]
|
||||
if (nOp === OPS.OP_0) return false
|
||||
if (nOp < OPS.OP_1) return false
|
||||
if (nOp > OPS.OP_16) return false
|
||||
|
||||
|
@ -239,7 +237,7 @@ function isMultisigOutput (script) {
|
|||
if (n < m) return false
|
||||
|
||||
var pubKeys = chunks.slice(1, -2)
|
||||
if (n < pubKeys.length) return false
|
||||
if (n !== pubKeys.length) return false
|
||||
|
||||
return pubKeys.every(isCanonicalPubKey)
|
||||
}
|
||||
|
|
4
test/fixtures/script.json
vendored
4
test/fixtures/script.json
vendored
|
@ -241,6 +241,10 @@
|
|||
"description": "n < len(pubKeys)",
|
||||
"scriptPubKey": "OP_2 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 02b80011a883a0fd621ad46dfc405df1e74bf075cbaf700fd4aebef6e96f848340 024289801366bcee6172b771cf5a7f13aaecd237a0b9a1ff9d769cabc2e6b70a34 OP_2 OP_CHECKMULTISIG"
|
||||
},
|
||||
{
|
||||
"description": "n > len(pubKeys)",
|
||||
"scriptPubKey": "OP_1 024289801366bcee6172b771cf5a7f13aaecd237a0b9a1ff9d769cabc2e6b70a34 OP_2 OP_CHECKMULTISIG"
|
||||
},
|
||||
{
|
||||
"description": "non-canonical pubKey (bad length)",
|
||||
"scriptPubKey": "OP_1 0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798ffff OP_1 OP_CHECKMULTISIG"
|
||||
|
|
Loading…
Add table
Reference in a new issue