def multisig_M_of_N(self, M, N, unsigned_id, signed_id):
    keys = [Key(secret_exponent=i, generator=secp256k1_generator) for i in range(1, (N + 2))]
    tx_in = TxIn.coinbase_tx_in(script=b'')
    script = script_for_multisig(m=M, sec_keys=[key.sec() for key in keys[:N]])
    tx_out = TxOut(1000000, script)
    tx1 = Tx(version=1, txs_in=[tx_in], txs_out=[tx_out])
    tx2 = tx_utils.create_tx(tx1.tx_outs_as_spendable(), [keys[(- 1)].address()])
    self.assertEqual(tx2.id(), unsigned_id)
    self.assertEqual(tx2.bad_solution_count(), 1)
    hash160_lookup = build_hash160_lookup((key.secret_exponent() for key in keys[:M]), [secp256k1_generator])
    tx2.sign(hash160_lookup=hash160_lookup)
    self.assertEqual(tx2.id(), signed_id)
    self.assertEqual(tx2.bad_solution_count(), 0)
def multisig_M_of_N(self, M, N, unsigned_id, signed_id):
    keys = [Key(secret_exponent=i, generator=secp256k1_generator) for i in range(1, (N + 2))]
    tx_in = TxIn.coinbase_tx_in(script=b)
    script = script_for_multisig(m=M, sec_keys=[key.sec() for key in keys[:N]])
    tx_out = TxOut(1000000, script)
    tx1 = Tx(version=1, txs_in=[tx_in], txs_out=[tx_out])
    tx2 = tx_utils.create_tx(tx1.tx_outs_as_spendable(), [keys[(- 1)].address()])
    self.assertEqual(tx2.id(), unsigned_id)
    self.assertEqual(tx2.bad_solution_count(), 1)
    hash160_lookup = build_hash160_lookup((key.secret_exponent() for key in keys[:M]), [secp256k1_generator])
    tx2.sign(hash160_lookup=hash160_lookup)
    self.assertEqual(tx2.id(), signed_id)
    self.assertEqual(tx2.bad_solution_count(), 0)