Skip to content

Commit eb9a51f

Browse files
committed
load new service config if missing
1 parent 6b3841b commit eb9a51f

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

chia/cmds/configure.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ def configure(
6464
if set_solver_peer:
6565
try:
6666
host, port = parse_host_port(set_solver_peer)
67+
# ensure farmer section has solver_peers field
68+
if "solver_peers" not in config["farmer"]:
69+
config["farmer"]["solver_peers"] = []
6770
# Set single solver peer (overrides any existing)
6871
config["farmer"]["solver_peers"] = [{"host": host, "port": port}]
6972
print(f"Solver peer updated to {host}:{port}")

chia/farmer/start_farmer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def create_farmer_service(
7474

7575
async def async_main(root_path: pathlib.Path) -> int:
7676
# TODO: refactor to avoid the double load
77-
config = load_config(root_path, "config.yaml")
77+
config = load_config(root_path, "config.yaml", fill_missing_services=True)
7878
service_config = load_config_cli(root_path, "config.yaml", SERVICE_NAME)
7979
config[SERVICE_NAME] = service_config
8080
config_pool = load_config_cli(root_path, "config.yaml", "pool")

chia/solver/start_solver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def create_solver_service(
7171

7272

7373
async def async_main(service_config: dict[str, Any], root_path: pathlib.Path) -> int:
74-
config = load_config(root_path, "config.yaml")
74+
config = load_config(root_path, "config.yaml", fill_missing_services=True)
7575
config[SERVICE_NAME] = service_config
7676
network_id = service_config["selected_network"]
7777
overrides = service_config["network_overrides"]["constants"][network_id]

chia/util/config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,12 @@ def selected_network_address_prefix(config: dict[str, Any]) -> str:
305305

306306

307307
def load_defaults_for_missing_services(config: dict[str, Any], config_name: str) -> dict[str, Any]:
308-
services = ["data_layer"]
308+
services = ["data_layer", "solver"]
309309
missing_services = [service for service in services if service not in config]
310310
defaulted = {}
311311
if len(missing_services) > 0:
312312
marshalled_default_config: str = initial_config_file(config_name)
313-
314313
unmarshalled_default_config = yaml.safe_load(marshalled_default_config)
315-
316314
for service in missing_services:
317315
defaulted[service] = unmarshalled_default_config[service]
318316

0 commit comments

Comments
 (0)