Beispiel #1
0
 def from_script(script):
     if not ScriptMutlisig.match(script):
         raise Exception("Not a TX_SCRIPT_HASH script")
     m = get_pushed_smallint(script.instructions[0].opcode)
     n = get_pushed_smallint(script.instructions[-2].opcode)
     pubkeys = [script.instructions[i+1].data for i in range(n) ]
     return ScriptMutlisig(m, pubkeys)
Beispiel #2
0
 def from_script(script):
     if not ScriptMutlisig.match(script):
         raise Exception("Not a TX_SCRIPT_HASH script")
     m = get_pushed_smallint(script.instructions[0].opcode)
     n = get_pushed_smallint(script.instructions[-2].opcode)
     pubkeys = [script.instructions[i + 1].data for i in range(n)]
     return ScriptMutlisig(m, pubkeys)
Beispiel #3
0
 def match(script):
     if (len(script.instructions) <= 4 or # 4 is the minimum size (n=1)
         script.instructions[-1].opcode != OP_CHECKMULTISIG or 
         not is_smallint_pushdata(script.instructions[-2].opcode)):
         return False
     n = get_pushed_smallint(script.instructions[-2].opcode)
     if len(script.instructions) != n + 3: # n*pubkeys + (m,n,OP_CHECKMULTISIG)
         return False
     if not is_smallint_pushdata(script.instructions[0].opcode):
         return False
     m = get_pushed_smallint(script.instructions[0].opcode)
     if m > n:
         return False
     for i in range(n):
         if (not script.instructions[1+i].is_pushdata() or 
             not (33 <= len(script.instructions[1+i].data) <= 120)):
             return False
     return (True)
Beispiel #4
0
 def match(script):
     if (len(script.instructions) <= 4 or  # 4 is the minimum size (n=1)
             script.instructions[-1].opcode != OP_CHECKMULTISIG or
             not is_smallint_pushdata(script.instructions[-2].opcode)):
         return False
     n = get_pushed_smallint(script.instructions[-2].opcode)
     if len(script.instructions
            ) != n + 3:  # n*pubkeys + (m,n,OP_CHECKMULTISIG)
         return False
     if not is_smallint_pushdata(script.instructions[0].opcode):
         return False
     m = get_pushed_smallint(script.instructions[0].opcode)
     if m > n:
         return False
     for i in range(n):
         if (not script.instructions[1 + i].is_pushdata() or
                 not (33 <= len(script.instructions[1 + i].data) <= 120)):
             return False
     return (True)