You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 28, 2019. It is now read-only.
In BitcoinScirpt Class,“matchMultisig” method below:
public func matchMultisig() -> ([PublicKey], required: Int)? {
if bytes.count < 1 || bytes.last != OpCode.OP_CHECKMULTISIG {
return nil
}
var keys = [PublicKey]()
var it = bytes.startIndex
guard let (opcode, _) = getScriptOp(index: &it), OpCode.isSmallInteger(opcode) else {
return nil
}
let required = BitcoinScript.decodeNumber(opcode: opcode)
while case .some(_, let data?) = getScriptOp(index: &it), let key = PublicKey(data: data) {
keys.append(key)
}
if !OpCode.isSmallInteger(opcode) {
return nil
}
let expectedCount = BitcoinScript.decodeNumber(opcode: opcode)
if keys.count != expectedCount || expectedCount < required {
return nil
}
if it + 1 != bytes.endIndex {
return nil
}
return (keys, required)
}
'expectedCount' is equal to 'required', so below code must be entered, and return nil:
if keys.count != expectedCount || expectedCount < required {
return nil
}