def test_sign_p2sh(self):
    tx_out_script = h2b('76a91491b24bf9f5288532960ac687abb035127b1d28a588ac')
    script = script_for_address('1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm')
    self.assertEqual(tx_out_script, script)
    tx_out = TxOut(100, tx_out_script)
    tx = Tx(1, [TxIn((b'\x01' * 32), 1)], [TxOut(100, tx_out_script)])
    tx.set_unspents([tx_out])
    hl = build_hash160_lookup([1], [secp256k1_generator])
    self.assertEqual(tx.bad_solution_count(), 1)
    tx.sign(hash160_lookup=hl)
    self.assertEqual(tx.bad_solution_count(), 0)
def test_sign_p2sh(self):
    tx_out_script = h2b('76a91491b24bf9f5288532960ac687abb035127b1d28a588ac')
    script = script_for_address('1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm')
    self.assertEqual(tx_out_script, script)
    tx_out = TxOut(100, tx_out_script)
    tx = Tx(1, [TxIn((b'\x01' * 32), 1)], [TxOut(100, tx_out_script)])
    tx.set_unspents([tx_out])
    hl = build_hash160_lookup([1], [secp256k1_generator])
    self.assertEqual(tx.bad_solution_count(), 1)
    tx.sign(hash160_lookup=hl)
    self.assertEqual(tx.bad_solution_count(), 0)