예제 #1
0
    def test_p2_delegated_conditions(self):
        key_lookup = KeyTool()
        payments, conditions = default_payments_and_conditions(1, key_lookup)

        pk = public_key_for_index(1, key_lookup)

        puzzle = p2_delegated_conditions.puzzle_for_pk(pk)
        solution = p2_delegated_conditions.solution_for_conditions(conditions)

        do_test_spend(puzzle, solution, payments, key_lookup)
예제 #2
0
    def test_p2_delegated_puzzle_graftroot(self):
        key_lookup = KeyTool()
        payments, conditions = default_payments_and_conditions(1, key_lookup)

        delegated_puzzle = p2_delegated_conditions.puzzle_for_pk(public_key_for_index(8, key_lookup))
        delegated_solution = p2_delegated_conditions.solution_for_conditions(conditions)

        puzzle_program = p2_delegated_puzzle.puzzle_for_pk(public_key_for_index(1, key_lookup))
        solution = p2_delegated_puzzle.solution_for_delegated_puzzle(delegated_puzzle, delegated_solution)

        do_test_spend(puzzle_program, solution, payments, key_lookup)
예제 #3
0
    def test_p2_puzzle_hash(self):
        key_lookup = KeyTool()
        payments, conditions = default_payments_and_conditions(1, key_lookup)

        inner_puzzle = p2_delegated_conditions.puzzle_for_pk(public_key_for_index(4, key_lookup))
        inner_solution = p2_delegated_conditions.solution_for_conditions(conditions)
        inner_puzzle_hash = inner_puzzle.get_tree_hash()

        puzzle_program = p2_puzzle_hash.puzzle_for_inner_puzzle_hash(inner_puzzle_hash)
        assert puzzle_program == p2_puzzle_hash.puzzle_for_inner_puzzle(inner_puzzle)
        solution = p2_puzzle_hash.solution_for_inner_puzzle_and_inner_solution(inner_puzzle, inner_solution)

        do_test_spend(puzzle_program, solution, payments, key_lookup)