@api_request
async def request_puzzle_solution(self, request: wallet_protocol.RequestPuzzleSolution) -> Optional[Message]:
    coin_name = request.coin_name
    height = request.height
    coin_record = (await self.full_node.coin_store.get_coin_record(coin_name))
    reject = wallet_protocol.RejectPuzzleSolution(coin_name, height)
    reject_msg = make_msg(ProtocolMessageTypes.reject_puzzle_solution, reject)
    if ((coin_record is None) or (coin_record.spent_block_index != height)):
        return reject_msg
    header_hash: Optional[bytes32] = self.full_node.blockchain.height_to_hash(height)
    if (header_hash is None):
        return reject_msg
    block: Optional[FullBlock] = (await self.full_node.block_store.get_full_block(header_hash))
    if ((block is None) or (block.transactions_generator is None)):
        return reject_msg
    block_generator: Optional[BlockGenerator] = (await self.full_node.blockchain.get_block_generator(block))
    assert (block_generator is not None)
    (error, puzzle, solution) = get_puzzle_and_solution_for_coin(block_generator, coin_name, self.full_node.constants.MAX_BLOCK_COST_CLVM)
    if (error is not None):
        return reject_msg
    pz = Program.to(puzzle)
    sol = Program.to(solution)
    wrapper = PuzzleSolutionResponse(coin_name, height, pz, sol)
    response = wallet_protocol.RespondPuzzleSolution(wrapper)
    response_msg = make_msg(ProtocolMessageTypes.respond_puzzle_solution, response)
    return response_msg
@api_request
async def request_puzzle_solution(self, request: wallet_protocol.RequestPuzzleSolution) -> Optional[Message]:
    coin_name = request.coin_name
    height = request.height
    coin_record = (await self.full_node.coin_store.get_coin_record(coin_name))
    reject = wallet_protocol.RejectPuzzleSolution(coin_name, height)
    reject_msg = make_msg(ProtocolMessageTypes.reject_puzzle_solution, reject)
    if ((coin_record is None) or (coin_record.spent_block_index != height)):
        return reject_msg
    header_hash: Optional[bytes32] = self.full_node.blockchain.height_to_hash(height)
    if (header_hash is None):
        return reject_msg
    block: Optional[FullBlock] = (await self.full_node.block_store.get_full_block(header_hash))
    if ((block is None) or (block.transactions_generator is None)):
        return reject_msg
    block_generator: Optional[BlockGenerator] = (await self.full_node.blockchain.get_block_generator(block))
    assert (block_generator is not None)
    (error, puzzle, solution) = get_puzzle_and_solution_for_coin(block_generator, coin_name, self.full_node.constants.MAX_BLOCK_COST_CLVM)
    if (error is not None):
        return reject_msg
    pz = Program.to(puzzle)
    sol = Program.to(solution)
    wrapper = PuzzleSolutionResponse(coin_name, height, pz, sol)
    response = wallet_protocol.RespondPuzzleSolution(wrapper)
    response_msg = make_msg(ProtocolMessageTypes.respond_puzzle_solution, response)
    return response_msg