Chia-Network / chia-blockchain-gui

Chia blockchain GUI in electron/react
https://chia.net
Apache License 2.0
331 stars 247 forks source link

Run `chia init` on the first run #2327

Closed ChiaMineJP closed 4 months ago

ChiaMineJP commented 4 months ago

From 2.3.0, the GUI launches daemon by chia start daemon --skip-keyring instead of chia run_daemon --wait-for-unlock. On the first GUI run, there is no CHIA_ROOT directory and config files. chia run_daemon always tries to run chia init on start up while chia start daemon doesn't. So, on the first run without CHIA_ROOT directory, the new 2.3.0 GUI can never read CHIA_ROOT/config/config.yaml because it won't be created.

This PR let the GUI search for the CHIA_ROOT/config/config.yaml and if it doesn't exist it invokes chia init.

Test

Tested against Ubuntu 22.04 (x64) in cases (1) with no $CHIA_ROOT/config/config.yaml created yet (2) with $CHIA_ROOT/config/config.yaml created

The test succeeded. Before this PR, with 2.3.0 and with no config.yaml created, the GUI never proceed from loading screen. After applying this PR, the GUI proceeds to run.