Merge #919: Go directly to installer if datadir empty

ca583cd847c757ff5b4f6e9db15ce714d825c1a7 go directly to installer if datadir empty (pythcoiner)

Pull request description:

  address #263, now if there is a .liana dir already existing but not network folder (`bitcoin`/`testnet`/`signet`/`regtest`) inside, liana start directly into installer (before is was starting the launcher even if no network to launch, and displaying a weird 'Install liana on another network')

ACKs for top commit:
  darosior:
    ACK ca583cd847c757ff5b4f6e9db15ce714d825c1a7 -- as per Edouard's review

Tree-SHA512: e4c7725c277082fa354bb9397744dfa92e90c14e96b21cad31cb3e111424de15b9aeab1a4d775a59efcf43b385616852e64b1cd2d184f1ddef4be5348d380218
This commit is contained in:
Antoine Poinsot 2024-01-15 23:37:49 +01:00
commit 6c1430e8bc
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -334,7 +334,12 @@ impl Config {
Err(ConfigError::NotFound) => Ok(Config::Install(datadir_path, network)),
Err(e) => Err(format!("Failed to read configuration file: {}", e).into()),
}
} else if !datadir_path.exists() {
} else if !datadir_path.exists()
|| (!datadir_path.join("bitcoin").exists()
&& !datadir_path.join("testnet").exists()
&& !datadir_path.join("signet").exists()
&& !datadir_path.join("regtest").exists())
{
Ok(Config::Install(datadir_path, bitcoin::Network::Bitcoin))
} else {
Ok(Config::Launcher(datadir_path))