def generate_multisig_redeem_list(pubkeys, m):
    '''
    creates m of n multisig redeem script, encoded as a list
    pubkeys is a list of pubkeys
    m is the number of signatures required to redeem
    '''
    op_m = CScriptOp.encode_op_n(m)
    op_n = CScriptOp.encode_op_n(len(pubkeys))
    redeem_list = pubkeys
    redeem_list.insert(0, op_m)
    redeem_list.append(op_n)
    redeem_list.append(OP_CHECKMULTISIG)
    return redeem_list
Exemple #2
0
        def t(n, op):
            actual = CScriptOp.encode_op_n(n)
            self.assertEqual(actual, op)
            self.assertTrue(isinstance(actual, CScriptOp))

            actual = op.decode_op_n()
            self.assertEqual(actual, n)
            self.assertTrue(isinstance(actual, int))
        def t(n: int, op: CScriptOp) -> None:
            actual_op = CScriptOp.encode_op_n(n)
            self.assertEqual(actual_op, op)
            self.assertTrue(isinstance(actual_op, CScriptOp))

            actual_int = op.decode_op_n()
            self.assertEqual(actual_int, n)
            self.assertTrue(isinstance(actual_int, int))