We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG] Need to check pool contract address on existing plot
**Describe the bug**
You can see the public farmer key of a plot but not the pool contract address when using chia plots check

**To Reproduce**
Chia plots check, pool address is blank, no area for contract address

**Expected behavior**
Show pool contract address

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `chia/plotting/check_plots.py`
Content:
```
1 import logging
2 from collections import Counter
3 from pathlib import Path
4 from time import time, sleep
5 from typing import List
6 
7 from blspy import G1Element
8 from chiapos import Verifier
9 
10 from chia.plotting.manager import PlotManager
11 from chia.plotting.util import (
12     PlotRefreshResult,
13     PlotsRefreshParameter,
14     PlotRefreshEvents,
15     get_plot_filenames,
16     find_duplicate_plot_IDs,
17     parse_plot_info,
18 )
19 from chia.util.config import load_config
20 from chia.util.hash import std_hash
21 from chia.util.keychain import Keychain
22 from chia.wallet.derive_keys import master_sk_to_farmer_sk, master_sk_to_local_sk
23 
24 log = logging.getLogger(__name__)
25 
26 
27 def plot_refresh_callback(event: PlotRefreshEvents, refresh_result: PlotRefreshResult):
28     log.info(f"event: {event.name}, loaded {refresh_result.loaded} plots, {refresh_result.remaining} remaining")
29 
30 
31 def check_plots(root_path, num, challenge_start, grep_string, list_duplicates, debug_show_memo):
32     config = load_config(root_path, "config.yaml")
33     plot_refresh_parameter: PlotsRefreshParameter = PlotsRefreshParameter(batch_sleep_milliseconds=0)
34     plot_manager: PlotManager = PlotManager(
35         root_path,
36         match_str=grep_string,
37         show_memo=debug_show_memo,
38         open_no_key_filenames=True,
39         refresh_parameter=plot_refresh_parameter,
40         refresh_callback=plot_refresh_callback,
41     )
42     if num is not None:
43         if num == 0:
44             log.warning("Not opening plot files")
45         else:
46             if num < 5:
47                 log.warning(f"{num} challenges is too low, setting it to the minimum of 5")
48                 num = 5
49             if num < 30:
50                 log.warning("Use 30 challenges (our default) for balance of speed and accurate results")
51     else:
52         num = 30
53 
54     if challenge_start is not None:
55         num_start = challenge_start
56         num_end = num_start + num
57     else:
58         num_start = 0
59         num_end = num
60     challenges = num_end - num_start
61 
62     if list_duplicates:
63         log.warning("Checking for duplicate Plot IDs")
64         log.info("Plot filenames expected to end with -[64 char plot ID].plot")
65 
66     if list_duplicates:
67         all_filenames: List[Path] = []
68         for paths in get_plot_filenames(root_path).values():
69             all_filenames += paths
70         find_duplicate_plot_IDs(all_filenames)
71 
72     if num == 0:
73         return None
74 
75     parallel_read: bool = config["harvester"].get("parallel_read", True)
76 
77     v = Verifier()
78     log.info(f"Loading plots in config.yaml using plot_manager loading code (parallel read: {parallel_read})\n")
79     # Prompts interactively if the keyring is protected by a master passphrase. To use the daemon
80     # for keychain access, KeychainProxy/connect_to_keychain should be used instead of Keychain.
81     kc: Keychain = Keychain()
82     plot_manager.set_public_keys(
83         [master_sk_to_farmer_sk(sk).get_g1() for sk, _ in kc.get_all_private_keys()],
84         [G1Element.from_bytes(bytes.fromhex(pk)) for pk in config["farmer"]["pool_public_keys"]],
85     )
86     plot_manager.start_refreshing()
87 
88     while plot_manager.needs_refresh():
89         sleep(1)
90 
91     plot_manager.stop_refreshing()
92 
93     if plot_manager.plot_count() > 0:
94         log.info("")
95         log.info("")
96         log.info(f"Starting to test each plot with {num} challenges each\n")
97     total_good_plots: Counter = Counter()
98     total_size = 0
99     bad_plots_list: List[Path] = []
100 
101     with plot_manager:
102         for plot_path, plot_info in plot_manager.plots.items():
103             pr = plot_info.prover
104             log.info(f"Testing plot {plot_path} k={pr.get_size()}")
105             log.info(f"\tPool public key: {plot_info.pool_public_key}")
106 
107             # Look up local_sk from plot to save locked memory
108             (
109                 pool_public_key_or_puzzle_hash,
110                 farmer_public_key,
111                 local_master_sk,
112             ) = parse_plot_info(pr.get_memo())
113             local_sk = master_sk_to_local_sk(local_master_sk)
114             log.info(f"\tFarmer public key: {farmer_public_key}")
115             log.info(f"\tLocal sk: {local_sk}")
116             total_proofs = 0
117             caught_exception: bool = False
118             for i in range(num_start, num_end):
119                 challenge = std_hash(i.to_bytes(32, "big"))
120                 # Some plot errors cause get_qualities_for_challenge to throw a RuntimeError
121                 try:
122                     quality_start_time = int(round(time() * 1000))
123                     for index, quality_str in enumerate(pr.get_qualities_for_challenge(challenge)):
124                         quality_spent_time = int(round(time() * 1000)) - quality_start_time
125                         if quality_spent_time > 5000:
126                             log.warning(
127                                 f"\tLooking up qualities took: {quality_spent_time} ms. This should be below 5 seconds "
128                                 f"to minimize risk of losing rewards."
129                             )
130                         else:
131                             log.info(f"\tLooking up qualities took: {quality_spent_time} ms.")
132 
133                         # Other plot errors cause get_full_proof or validate_proof to throw an AssertionError
134                         try:
135                             proof_start_time = int(round(time() * 1000))
136                             proof = pr.get_full_proof(challenge, index, parallel_read)
137                             proof_spent_time = int(round(time() * 1000)) - proof_start_time
138                             if proof_spent_time > 15000:
139                                 log.warning(
140                                     f"\tFinding proof took: {proof_spent_time} ms. This should be below 15 seconds "
141                                     f"to minimize risk of losing rewards."
142                                 )
143                             else:
144                                 log.info(f"\tFinding proof took: {proof_spent_time} ms")
145                             total_proofs += 1
146                             ver_quality_str = v.validate_proof(pr.get_id(), pr.get_size(), challenge, proof)
147                             assert quality_str == ver_quality_str
148                         except AssertionError as e:
149                             log.error(f"{type(e)}: {e} error in proving/verifying for plot {plot_path}")
150                             caught_exception = True
151                         quality_start_time = int(round(time() * 1000))
152                 except KeyboardInterrupt:
153                     log.warning("Interrupted, closing")
154                     return None
155                 except SystemExit:
156                     log.warning("System is shutting down.")
157                     return None
158                 except Exception as e:
159                     log.error(f"{type(e)}: {e} error in getting challenge qualities for plot {plot_path}")
160                     caught_exception = True
161                 if caught_exception is True:
162                     break
163             if total_proofs > 0 and caught_exception is False:
164                 log.info(f"\tProofs {total_proofs} / {challenges}, {round(total_proofs/float(challenges), 4)}")
165                 total_good_plots[pr.get_size()] += 1
166                 total_size += plot_path.stat().st_size
167             else:
168                 log.error(f"\tProofs {total_proofs} / {challenges}, {round(total_proofs/float(challenges), 4)}")
169                 bad_plots_list.append(plot_path)
170     log.info("")
171     log.info("")
172     log.info("Summary")
173     total_plots: int = sum(list(total_good_plots.values()))
174     log.info(f"Found {total_plots} valid plots, total size {total_size / (1024 * 1024 * 1024 * 1024):.5f} TiB")
175     for (k, count) in sorted(dict(total_good_plots).items()):
176         log.info(f"{count} plots of size {k}")
177     grand_total_bad = len(bad_plots_list) + len(plot_manager.failed_to_open_filenames)
178     if grand_total_bad > 0:
179         log.warning(f"{grand_total_bad} invalid plots found:")
180         if len(bad_plots_list) > 0:
181             log.warning(f"    {len(bad_plots_list)} bad plots:")
182             for bad_plot_path in bad_plots_list:
183                 log.warning(f"{bad_plot_path}")
184         if len(plot_manager.failed_to_open_filenames) > 0:
185             log.warning(f"    {len(plot_manager.failed_to_open_filenames)} unopenable plots:")
186             for unopenable_plot_path in plot_manager.failed_to_open_filenames.keys():
187                 log.warning(f"{unopenable_plot_path}")
188     if len(plot_manager.no_key_filenames) > 0:
189         log.warning(
190             f"There are {len(plot_manager.no_key_filenames)} plots with a farmer or pool public key that "
191             f"is not on this machine. The farmer private key must be in the keychain in order to "
192             f"farm them, use 'chia keys' to transfer keys. The pool public keys must be in the config.yaml"
193         )
194
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/chia/plotting/check_plots.py b/chia/plotting/check_plots.py
--- a/chia/plotting/check_plots.py
+++ b/chia/plotting/check_plots.py
@@ -16,6 +16,7 @@
     find_duplicate_plot_IDs,
     parse_plot_info,
 )
+from chia.util.bech32m import encode_puzzle_hash
 from chia.util.config import load_config
 from chia.util.hash import std_hash
 from chia.util.keychain import Keychain
@@ -30,6 +31,7 @@
 
 def check_plots(root_path, num, challenge_start, grep_string, list_duplicates, debug_show_memo):
     config = load_config(root_path, "config.yaml")
+    address_prefix = config["network_overrides"]["config"][config["selected_network"]]["address_prefix"]
     plot_refresh_parameter: PlotsRefreshParameter = PlotsRefreshParameter(batch_sleep_milliseconds=0)
     plot_manager: PlotManager = PlotManager(
         root_path,
@@ -102,7 +104,11 @@
         for plot_path, plot_info in plot_manager.plots.items():
             pr = plot_info.prover
             log.info(f"Testing plot {plot_path} k={pr.get_size()}")
-            log.info(f"\tPool public key: {plot_info.pool_public_key}")
+            if plot_info.pool_public_key is not None:
+                log.info(f"\t{'Pool public key:':<23} {plot_info.pool_public_key}")
+            if plot_info.pool_contract_puzzle_hash is not None:
+                pca: str = encode_puzzle_hash(plot_info.pool_contract_puzzle_hash, address_prefix)
+                log.info(f"\t{'Pool contract address:':<23} {pca}")
 
             # Look up local_sk from plot to save locked memory
             (
@@ -111,8 +117,8 @@
                 local_master_sk,
             ) = parse_plot_info(pr.get_memo())
             local_sk = master_sk_to_local_sk(local_master_sk)
-            log.info(f"\tFarmer public key: {farmer_public_key}")
-            log.info(f"\tLocal sk: {local_sk}")
+            log.info(f"\t{'Farmer public key:' :<23} {farmer_public_key}")
+            log.info(f"\t{'Local sk:' :<23} {local_sk}")
             total_proofs = 0
             caught_exception: bool = False
             for i in range(num_start, num_end):

{"golden_diff": "diff --git a/chia/plotting/check_plots.py b/chia/plotting/check_plots.py\n--- a/chia/plotting/check_plots.py\n+++ b/chia/plotting/check_plots.py\n@@ -16,6 +16,7 @@\n     find_duplicate_plot_IDs,\n     parse_plot_info,\n )\n+from chia.util.bech32m import encode_puzzle_hash\n from chia.util.config import load_config\n from chia.util.hash import std_hash\n from chia.util.keychain import Keychain\n@@ -30,6 +31,7 @@\n \n def check_plots(root_path, num, challenge_start, grep_string, list_duplicates, debug_show_memo):\n     config = load_config(root_path, \"config.yaml\")\n+    address_prefix = config[\"network_overrides\"][\"config\"][config[\"selected_network\"]][\"address_prefix\"]\n     plot_refresh_parameter: PlotsRefreshParameter = PlotsRefreshParameter(batch_sleep_milliseconds=0)\n     plot_manager: PlotManager = PlotManager(\n         root_path,\n@@ -102,7 +104,11 @@\n         for plot_path, plot_info in plot_manager.plots.items():\n             pr = plot_info.prover\n             log.info(f\"Testing plot {plot_path} k={pr.get_size()}\")\n-            log.info(f\"\\tPool public key: {plot_info.pool_public_key}\")\n+            if plot_info.pool_public_key is not None:\n+                log.info(f\"\\t{'Pool public key:':<23} {plot_info.pool_public_key}\")\n+            if plot_info.pool_contract_puzzle_hash is not None:\n+                pca: str = encode_puzzle_hash(plot_info.pool_contract_puzzle_hash, address_prefix)\n+                log.info(f\"\\t{'Pool contract address:':<23} {pca}\")\n \n             # Look up local_sk from plot to save locked memory\n             (\n@@ -111,8 +117,8 @@\n                 local_master_sk,\n             ) = parse_plot_info(pr.get_memo())\n             local_sk = master_sk_to_local_sk(local_master_sk)\n-            log.info(f\"\\tFarmer public key: {farmer_public_key}\")\n-            log.info(f\"\\tLocal sk: {local_sk}\")\n+            log.info(f\"\\t{'Farmer public key:' :<23} {farmer_public_key}\")\n+            log.info(f\"\\t{'Local sk:' :<23} {local_sk}\")\n             total_proofs = 0\n             caught_exception: bool = False\n             for i in range(num_start, num_end):\n", "issue": "[BUG] Need to check pool contract address on existing plot\n**Describe the bug**\r\nYou can see the public farmer key of a plot but not the pool contract address when using chia plots check\r\n\r\n**To Reproduce**\r\nChia plots check, pool address is blank, no area for contract address\r\n\r\n**Expected behavior**\r\nShow pool contract address\n", "before_files": [{"content": "import logging\nfrom collections import Counter\nfrom pathlib import Path\nfrom time import time, sleep\nfrom typing import List\n\nfrom blspy import G1Element\nfrom chiapos import Verifier\n\nfrom chia.plotting.manager import PlotManager\nfrom chia.plotting.util import (\n    PlotRefreshResult,\n    PlotsRefreshParameter,\n    PlotRefreshEvents,\n    get_plot_filenames,\n    find_duplicate_plot_IDs,\n    parse_plot_info,\n)\nfrom chia.util.config import load_config\nfrom chia.util.hash import std_hash\nfrom chia.util.keychain import Keychain\nfrom chia.wallet.derive_keys import master_sk_to_farmer_sk, master_sk_to_local_sk\n\nlog = logging.getLogger(__name__)\n\n\ndef plot_refresh_callback(event: PlotRefreshEvents, refresh_result: PlotRefreshResult):\n    log.info(f\"event: {event.name}, loaded {refresh_result.loaded} plots, {refresh_result.remaining} remaining\")\n\n\ndef check_plots(root_path, num, challenge_start, grep_string, list_duplicates, debug_show_memo):\n    config = load_config(root_path, \"config.yaml\")\n    plot_refresh_parameter: PlotsRefreshParameter = PlotsRefreshParameter(batch_sleep_milliseconds=0)\n    plot_manager: PlotManager = PlotManager(\n        root_path,\n        match_str=grep_string,\n        show_memo=debug_show_memo,\n        open_no_key_filenames=True,\n        refresh_parameter=plot_refresh_parameter,\n        refresh_callback=plot_refresh_callback,\n    )\n    if num is not None:\n        if num == 0:\n            log.warning(\"Not opening plot files\")\n        else:\n            if num < 5:\n                log.warning(f\"{num} challenges is too low, setting it to the minimum of 5\")\n                num = 5\n            if num < 30:\n                log.warning(\"Use 30 challenges (our default) for balance of speed and accurate results\")\n    else:\n        num = 30\n\n    if challenge_start is not None:\n        num_start = challenge_start\n        num_end = num_start + num\n    else:\n        num_start = 0\n        num_end = num\n    challenges = num_end - num_start\n\n    if list_duplicates:\n        log.warning(\"Checking for duplicate Plot IDs\")\n        log.info(\"Plot filenames expected to end with -[64 char plot ID].plot\")\n\n    if list_duplicates:\n        all_filenames: List[Path] = []\n        for paths in get_plot_filenames(root_path).values():\n            all_filenames += paths\n        find_duplicate_plot_IDs(all_filenames)\n\n    if num == 0:\n        return None\n\n    parallel_read: bool = config[\"harvester\"].get(\"parallel_read\", True)\n\n    v = Verifier()\n    log.info(f\"Loading plots in config.yaml using plot_manager loading code (parallel read: {parallel_read})\\n\")\n    # Prompts interactively if the keyring is protected by a master passphrase. To use the daemon\n    # for keychain access, KeychainProxy/connect_to_keychain should be used instead of Keychain.\n    kc: Keychain = Keychain()\n    plot_manager.set_public_keys(\n        [master_sk_to_farmer_sk(sk).get_g1() for sk, _ in kc.get_all_private_keys()],\n        [G1Element.from_bytes(bytes.fromhex(pk)) for pk in config[\"farmer\"][\"pool_public_keys\"]],\n    )\n    plot_manager.start_refreshing()\n\n    while plot_manager.needs_refresh():\n        sleep(1)\n\n    plot_manager.stop_refreshing()\n\n    if plot_manager.plot_count() > 0:\n        log.info(\"\")\n        log.info(\"\")\n        log.info(f\"Starting to test each plot with {num} challenges each\\n\")\n    total_good_plots: Counter = Counter()\n    total_size = 0\n    bad_plots_list: List[Path] = []\n\n    with plot_manager:\n        for plot_path, plot_info in plot_manager.plots.items():\n            pr = plot_info.prover\n            log.info(f\"Testing plot {plot_path} k={pr.get_size()}\")\n            log.info(f\"\\tPool public key: {plot_info.pool_public_key}\")\n\n            # Look up local_sk from plot to save locked memory\n            (\n                pool_public_key_or_puzzle_hash,\n                farmer_public_key,\n                local_master_sk,\n            ) = parse_plot_info(pr.get_memo())\n            local_sk = master_sk_to_local_sk(local_master_sk)\n            log.info(f\"\\tFarmer public key: {farmer_public_key}\")\n            log.info(f\"\\tLocal sk: {local_sk}\")\n            total_proofs = 0\n            caught_exception: bool = False\n            for i in range(num_start, num_end):\n                challenge = std_hash(i.to_bytes(32, \"big\"))\n                # Some plot errors cause get_qualities_for_challenge to throw a RuntimeError\n                try:\n                    quality_start_time = int(round(time() * 1000))\n                    for index, quality_str in enumerate(pr.get_qualities_for_challenge(challenge)):\n                        quality_spent_time = int(round(time() * 1000)) - quality_start_time\n                        if quality_spent_time > 5000:\n                            log.warning(\n                                f\"\\tLooking up qualities took: {quality_spent_time} ms. This should be below 5 seconds \"\n                                f\"to minimize risk of losing rewards.\"\n                            )\n                        else:\n                            log.info(f\"\\tLooking up qualities took: {quality_spent_time} ms.\")\n\n                        # Other plot errors cause get_full_proof or validate_proof to throw an AssertionError\n                        try:\n                            proof_start_time = int(round(time() * 1000))\n                            proof = pr.get_full_proof(challenge, index, parallel_read)\n                            proof_spent_time = int(round(time() * 1000)) - proof_start_time\n                            if proof_spent_time > 15000:\n                                log.warning(\n                                    f\"\\tFinding proof took: {proof_spent_time} ms. This should be below 15 seconds \"\n                                    f\"to minimize risk of losing rewards.\"\n                                )\n                            else:\n                                log.info(f\"\\tFinding proof took: {proof_spent_time} ms\")\n                            total_proofs += 1\n                            ver_quality_str = v.validate_proof(pr.get_id(), pr.get_size(), challenge, proof)\n                            assert quality_str == ver_quality_str\n                        except AssertionError as e:\n                            log.error(f\"{type(e)}: {e} error in proving/verifying for plot {plot_path}\")\n                            caught_exception = True\n                        quality_start_time = int(round(time() * 1000))\n                except KeyboardInterrupt:\n                    log.warning(\"Interrupted, closing\")\n                    return None\n                except SystemExit:\n                    log.warning(\"System is shutting down.\")\n                    return None\n                except Exception as e:\n                    log.error(f\"{type(e)}: {e} error in getting challenge qualities for plot {plot_path}\")\n                    caught_exception = True\n                if caught_exception is True:\n                    break\n            if total_proofs > 0 and caught_exception is False:\n                log.info(f\"\\tProofs {total_proofs} / {challenges}, {round(total_proofs/float(challenges), 4)}\")\n                total_good_plots[pr.get_size()] += 1\n                total_size += plot_path.stat().st_size\n            else:\n                log.error(f\"\\tProofs {total_proofs} / {challenges}, {round(total_proofs/float(challenges), 4)}\")\n                bad_plots_list.append(plot_path)\n    log.info(\"\")\n    log.info(\"\")\n    log.info(\"Summary\")\n    total_plots: int = sum(list(total_good_plots.values()))\n    log.info(f\"Found {total_plots} valid plots, total size {total_size / (1024 * 1024 * 1024 * 1024):.5f} TiB\")\n    for (k, count) in sorted(dict(total_good_plots).items()):\n        log.info(f\"{count} plots of size {k}\")\n    grand_total_bad = len(bad_plots_list) + len(plot_manager.failed_to_open_filenames)\n    if grand_total_bad > 0:\n        log.warning(f\"{grand_total_bad} invalid plots found:\")\n        if len(bad_plots_list) > 0:\n            log.warning(f\"    {len(bad_plots_list)} bad plots:\")\n            for bad_plot_path in bad_plots_list:\n                log.warning(f\"{bad_plot_path}\")\n        if len(plot_manager.failed_to_open_filenames) > 0:\n            log.warning(f\"    {len(plot_manager.failed_to_open_filenames)} unopenable plots:\")\n            for unopenable_plot_path in plot_manager.failed_to_open_filenames.keys():\n                log.warning(f\"{unopenable_plot_path}\")\n    if len(plot_manager.no_key_filenames) > 0:\n        log.warning(\n            f\"There are {len(plot_manager.no_key_filenames)} plots with a farmer or pool public key that \"\n            f\"is not on this machine. The farmer private key must be in the keychain in order to \"\n            f\"farm them, use 'chia keys' to transfer keys. The pool public keys must be in the config.yaml\"\n        )\n", "path": "chia/plotting/check_plots.py"}], "after_files": [{"content": "import logging\nfrom collections import Counter\nfrom pathlib import Path\nfrom time import time, sleep\nfrom typing import List\n\nfrom blspy import G1Element\nfrom chiapos import Verifier\n\nfrom chia.plotting.manager import PlotManager\nfrom chia.plotting.util import (\n    PlotRefreshResult,\n    PlotsRefreshParameter,\n    PlotRefreshEvents,\n    get_plot_filenames,\n    find_duplicate_plot_IDs,\n    parse_plot_info,\n)\nfrom chia.util.bech32m import encode_puzzle_hash\nfrom chia.util.config import load_config\nfrom chia.util.hash import std_hash\nfrom chia.util.keychain import Keychain\nfrom chia.wallet.derive_keys import master_sk_to_farmer_sk, master_sk_to_local_sk\n\nlog = logging.getLogger(__name__)\n\n\ndef plot_refresh_callback(event: PlotRefreshEvents, refresh_result: PlotRefreshResult):\n    log.info(f\"event: {event.name}, loaded {refresh_result.loaded} plots, {refresh_result.remaining} remaining\")\n\n\ndef check_plots(root_path, num, challenge_start, grep_string, list_duplicates, debug_show_memo):\n    config = load_config(root_path, \"config.yaml\")\n    address_prefix = config[\"network_overrides\"][\"config\"][config[\"selected_network\"]][\"address_prefix\"]\n    plot_refresh_parameter: PlotsRefreshParameter = PlotsRefreshParameter(batch_sleep_milliseconds=0)\n    plot_manager: PlotManager = PlotManager(\n        root_path,\n        match_str=grep_string,\n        show_memo=debug_show_memo,\n        open_no_key_filenames=True,\n        refresh_parameter=plot_refresh_parameter,\n        refresh_callback=plot_refresh_callback,\n    )\n    if num is not None:\n        if num == 0:\n            log.warning(\"Not opening plot files\")\n        else:\n            if num < 5:\n                log.warning(f\"{num} challenges is too low, setting it to the minimum of 5\")\n                num = 5\n            if num < 30:\n                log.warning(\"Use 30 challenges (our default) for balance of speed and accurate results\")\n    else:\n        num = 30\n\n    if challenge_start is not None:\n        num_start = challenge_start\n        num_end = num_start + num\n    else:\n        num_start = 0\n        num_end = num\n    challenges = num_end - num_start\n\n    if list_duplicates:\n        log.warning(\"Checking for duplicate Plot IDs\")\n        log.info(\"Plot filenames expected to end with -[64 char plot ID].plot\")\n\n    if list_duplicates:\n        all_filenames: List[Path] = []\n        for paths in get_plot_filenames(root_path).values():\n            all_filenames += paths\n        find_duplicate_plot_IDs(all_filenames)\n\n    if num == 0:\n        return None\n\n    parallel_read: bool = config[\"harvester\"].get(\"parallel_read\", True)\n\n    v = Verifier()\n    log.info(f\"Loading plots in config.yaml using plot_manager loading code (parallel read: {parallel_read})\\n\")\n    # Prompts interactively if the keyring is protected by a master passphrase. To use the daemon\n    # for keychain access, KeychainProxy/connect_to_keychain should be used instead of Keychain.\n    kc: Keychain = Keychain()\n    plot_manager.set_public_keys(\n        [master_sk_to_farmer_sk(sk).get_g1() for sk, _ in kc.get_all_private_keys()],\n        [G1Element.from_bytes(bytes.fromhex(pk)) for pk in config[\"farmer\"][\"pool_public_keys\"]],\n    )\n    plot_manager.start_refreshing()\n\n    while plot_manager.needs_refresh():\n        sleep(1)\n\n    plot_manager.stop_refreshing()\n\n    if plot_manager.plot_count() > 0:\n        log.info(\"\")\n        log.info(\"\")\n        log.info(f\"Starting to test each plot with {num} challenges each\\n\")\n    total_good_plots: Counter = Counter()\n    total_size = 0\n    bad_plots_list: List[Path] = []\n\n    with plot_manager:\n        for plot_path, plot_info in plot_manager.plots.items():\n            pr = plot_info.prover\n            log.info(f\"Testing plot {plot_path} k={pr.get_size()}\")\n            if plot_info.pool_public_key is not None:\n                log.info(f\"\\t{'Pool public key:':<23} {plot_info.pool_public_key}\")\n            if plot_info.pool_contract_puzzle_hash is not None:\n                pca: str = encode_puzzle_hash(plot_info.pool_contract_puzzle_hash, address_prefix)\n                log.info(f\"\\t{'Pool contract address:':<23} {pca}\")\n\n            # Look up local_sk from plot to save locked memory\n            (\n                pool_public_key_or_puzzle_hash,\n                farmer_public_key,\n                local_master_sk,\n            ) = parse_plot_info(pr.get_memo())\n            local_sk = master_sk_to_local_sk(local_master_sk)\n            log.info(f\"\\t{'Farmer public key:' :<23} {farmer_public_key}\")\n            log.info(f\"\\t{'Local sk:' :<23} {local_sk}\")\n            total_proofs = 0\n            caught_exception: bool = False\n            for i in range(num_start, num_end):\n                challenge = std_hash(i.to_bytes(32, \"big\"))\n                # Some plot errors cause get_qualities_for_challenge to throw a RuntimeError\n                try:\n                    quality_start_time = int(round(time() * 1000))\n                    for index, quality_str in enumerate(pr.get_qualities_for_challenge(challenge)):\n                        quality_spent_time = int(round(time() * 1000)) - quality_start_time\n                        if quality_spent_time > 5000:\n                            log.warning(\n                                f\"\\tLooking up qualities took: {quality_spent_time} ms. This should be below 5 seconds \"\n                                f\"to minimize risk of losing rewards.\"\n                            )\n                        else:\n                            log.info(f\"\\tLooking up qualities took: {quality_spent_time} ms.\")\n\n                        # Other plot errors cause get_full_proof or validate_proof to throw an AssertionError\n                        try:\n                            proof_start_time = int(round(time() * 1000))\n                            proof = pr.get_full_proof(challenge, index, parallel_read)\n                            proof_spent_time = int(round(time() * 1000)) - proof_start_time\n                            if proof_spent_time > 15000:\n                                log.warning(\n                                    f\"\\tFinding proof took: {proof_spent_time} ms. This should be below 15 seconds \"\n                                    f\"to minimize risk of losing rewards.\"\n                                )\n                            else:\n                                log.info(f\"\\tFinding proof took: {proof_spent_time} ms\")\n                            total_proofs += 1\n                            ver_quality_str = v.validate_proof(pr.get_id(), pr.get_size(), challenge, proof)\n                            assert quality_str == ver_quality_str\n                        except AssertionError as e:\n                            log.error(f\"{type(e)}: {e} error in proving/verifying for plot {plot_path}\")\n                            caught_exception = True\n                        quality_start_time = int(round(time() * 1000))\n                except KeyboardInterrupt:\n                    log.warning(\"Interrupted, closing\")\n                    return None\n                except SystemExit:\n                    log.warning(\"System is shutting down.\")\n                    return None\n                except Exception as e:\n                    log.error(f\"{type(e)}: {e} error in getting challenge qualities for plot {plot_path}\")\n                    caught_exception = True\n                if caught_exception is True:\n                    break\n            if total_proofs > 0 and caught_exception is False:\n                log.info(f\"\\tProofs {total_proofs} / {challenges}, {round(total_proofs/float(challenges), 4)}\")\n                total_good_plots[pr.get_size()] += 1\n                total_size += plot_path.stat().st_size\n            else:\n                log.error(f\"\\tProofs {total_proofs} / {challenges}, {round(total_proofs/float(challenges), 4)}\")\n                bad_plots_list.append(plot_path)\n    log.info(\"\")\n    log.info(\"\")\n    log.info(\"Summary\")\n    total_plots: int = sum(list(total_good_plots.values()))\n    log.info(f\"Found {total_plots} valid plots, total size {total_size / (1024 * 1024 * 1024 * 1024):.5f} TiB\")\n    for (k, count) in sorted(dict(total_good_plots).items()):\n        log.info(f\"{count} plots of size {k}\")\n    grand_total_bad = len(bad_plots_list) + len(plot_manager.failed_to_open_filenames)\n    if grand_total_bad > 0:\n        log.warning(f\"{grand_total_bad} invalid plots found:\")\n        if len(bad_plots_list) > 0:\n            log.warning(f\"    {len(bad_plots_list)} bad plots:\")\n            for bad_plot_path in bad_plots_list:\n                log.warning(f\"{bad_plot_path}\")\n        if len(plot_manager.failed_to_open_filenames) > 0:\n            log.warning(f\"    {len(plot_manager.failed_to_open_filenames)} unopenable plots:\")\n            for unopenable_plot_path in plot_manager.failed_to_open_filenames.keys():\n                log.warning(f\"{unopenable_plot_path}\")\n    if len(plot_manager.no_key_filenames) > 0:\n        log.warning(\n            f\"There are {len(plot_manager.no_key_filenames)} plots with a farmer or pool public key that \"\n            f\"is not on this machine. The farmer private key must be in the keychain in order to \"\n            f\"farm them, use 'chia keys' to transfer keys. The pool public keys must be in the config.yaml\"\n        )\n", "path": "chia/plotting/check_plots.py"}]}