Exemple #1
0
 def test_compressed_block_results(self):
     sb: SpendBundle = make_spend_bundle(1)
     start, end = match_standard_transaction_at_any_index(
         original_generator)
     ca = CompressorArg(uint32(0),
                        SerializedProgram.from_bytes(original_generator),
                        start, end)
     c = compressed_spend_bundle_solution(ca, sb)
     s = simple_solution_generator(sb)
     assert c != s
     cost_c, result_c = run_generator(c)
     cost_s, result_s = run_generator(s)
     print(result_c)
     assert result_c is not None
     assert result_s is not None
     assert result_c == result_s
 def test_get_removals_for_single_coin(self):
     sb: SpendBundle = make_spend_bundle(1)
     start, end = match_standard_transaction_at_any_index(
         original_generator)
     ca = CompressorArg(uint32(0),
                        SerializedProgram.from_bytes(original_generator),
                        start, end)
     c = compressed_spend_bundle_solution(ca, sb)
     removal = sb.coin_spends[0].coin.name()
     error, puzzle, solution = get_puzzle_and_solution_for_coin(
         c, removal, INFINITE_COST)
     assert error is None
     assert bytes(puzzle) == bytes(sb.coin_spends[0].puzzle_reveal)
     assert bytes(solution) == bytes(sb.coin_spends[0].solution)
     # Test non compressed generator as well
     s = simple_solution_generator(sb)
     error, puzzle, solution = get_puzzle_and_solution_for_coin(
         s, removal, INFINITE_COST)
     assert error is None
     assert bytes(puzzle) == bytes(sb.coin_spends[0].puzzle_reveal)
     assert bytes(solution) == bytes(sb.coin_spends[0].solution)