Add optional method parameter
MODIFY
WalletWasabi.Backend/InitConfigStartupTask.cs
WalletWasabi.Backend/InitConfigStartupTask.cs
@@ -25,7 +25,7 @@ public class InitConfigStartupTask : IStartupTask
var roundConfigFilePath = Path.Combine(Global.DataDir, "CcjRoundConfig.json");
var roundConfig = new CoordinatorRoundConfig(roundConfigFilePath);
- roundConfig.LoadOrCreateDefaultFile();
+ roundConfig.LoadOrCreateDefaultFile(createDefaultFile: true);
Logger.LogInfo("RoundConfig is successfully initialized.");
await Global.InitializeAsync(roundConfig, cancellationToken);

MODIFY
WalletWasabi.Backend/Startup.cs
WalletWasabi.Backend/Startup.cs
@@ -77,7 +77,7 @@ public class Startup
{
string configFilePath = Path.Combine(dataDir, "Config.json");
Config config = new(configFilePath);
- config.LoadOrCreateDefaultFile();
+ config.LoadOrCreateDefaultFile(createDefaultFile: true);
return config;
});

MODIFY
WalletWasabi.Fluent.Desktop/Program.cs
WalletWasabi.Fluent.Desktop/Program.cs
@@ -183,10 +183,10 @@ public class Program
Directory.CreateDirectory(dataDir);
UiConfig uiConfig = new(Path.Combine(dataDir, "UiConfig.json"));
- uiConfig.LoadOrCreateDefaultFile();
+ uiConfig.LoadOrCreateDefaultFile(createDefaultFile: true);
Config config = new(Path.Combine(dataDir, "Config.json"));
- config.LoadOrCreateDefaultFile();
+ config.LoadOrCreateDefaultFile(createDefaultFile: true);
return (uiConfig, config);
}

MODIFY
WalletWasabi.Fluent/Config.cs
WalletWasabi.Fluent/Config.cs
@@ -214,9 +214,9 @@ public class Config : ConfigBase
}
}
- public override void LoadOrCreateDefaultFile()
+ public override void LoadOrCreateDefaultFile(bool createDefaultFile = false)
{
- base.LoadOrCreateDefaultFile();
+ base.LoadOrCreateDefaultFile(createDefaultFile: true);
ServiceConfiguration = new ServiceConfiguration(GetBitcoinP2pEndPoint(), DustThreshold);
}

MODIFY
WalletWasabi.Tests/UnitTests/StartWasabiOnSystemStartupTests.cs
WalletWasabi.Tests/UnitTests/StartWasabiOnSystemStartupTests.cs
@@ -61,7 +61,7 @@ public class StartWasabiOnSystemStartupTests
{
string dataDir = EnvironmentHelpers.GetDataDir(Path.Combine("WalletWasabi", "Client"));
UiConfig uiConfig = new(Path.Combine(dataDir, "UiConfig.json"));
- uiConfig.LoadOrCreateDefaultFile();
+ uiConfig.LoadOrCreateDefaultFile(createDefaultFile: true);
return uiConfig;
}

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/ConfigTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/ConfigTests.cs
@@ -48,7 +48,7 @@ public class ConfigTests
// Change the file.
var configPath = Path.Combine(workDir, "WabiSabiConfig.json");
WabiSabiConfig configChanger = new(configPath);
- configChanger.LoadOrCreateDefaultFile();
+ configChanger.LoadOrCreateDefaultFile(createDefaultFile: true);
var newTarget = 729u;
configChanger.ConfirmationTarget = newTarget;
Assert.NotEqual(newTarget, coordinator.Config.ConfirmationTarget);
@@ -98,7 +98,7 @@ public class ConfigTests
public void LoadConfigFile()
{
WabiSabiConfig configChanger = new("./conf.txt");
- configChanger.LoadOrCreateDefaultFile();
+ configChanger.LoadOrCreateDefaultFile(createDefaultFile: true);
configChanger.LoadFile();
}
@@ -114,7 +114,7 @@ public class ConfigTests
var configPath = Path.Combine(workDir, "WabiSabiConfig.json");
WabiSabiConfig configChanger = new(configPath);
- configChanger.LoadOrCreateDefaultFile();
+ configChanger.LoadOrCreateDefaultFile(createDefaultFile: true);
var newTarget = 729u;
configChanger.ConfirmationTarget = newTarget;
Assert.NotEqual(newTarget, coordinator.Config.ConfirmationTarget);

MODIFY
WalletWasabi/Bases/ConfigBase.cs
WalletWasabi/Bases/ConfigBase.cs
@@ -59,7 +59,7 @@ public abstract class ConfigBase : NotifyPropertyChangedBase, IConfig
}
/// <inheritdoc />
- public virtual void LoadOrCreateDefaultFile()
+ public virtual void LoadOrCreateDefaultFile(bool createDefaultFile = false)
{
AssertFilePathSet();

MODIFY
WalletWasabi/Interfaces/IConfig.cs
WalletWasabi/Interfaces/IConfig.cs
@@ -15,7 +15,7 @@ public interface IConfig
void ToFile();
/// <summary>Load or create the config if the file path of the config file is set, otherwise throw exception.</summary>
- void LoadOrCreateDefaultFile();
+ void LoadOrCreateDefaultFile(bool createDefaultFile = false);
/// <summary>Load config if the file path of the config file is set, otherwise throw exception.</summary>
void LoadFile();

MODIFY
WalletWasabi/Services/ConfigWatcher.cs
WalletWasabi/Services/ConfigWatcher.cs
@@ -23,7 +23,7 @@ public class ConfigWatcher : PeriodicRunner
if (Config.CheckFileChange())
{
cancel.ThrowIfCancellationRequested();
- Config.LoadOrCreateDefaultFile();
+ Config.LoadOrCreateDefaultFile(createDefaultFile: true);
ExecuteWhenChanged();
}

MODIFY
WalletWasabi/WabiSabi/CoordinatorParameters.cs
WalletWasabi/WabiSabi/CoordinatorParameters.cs
@@ -13,7 +13,7 @@ public class CoordinatorParameters
var runtimeConfigurationFilePath = Path.Combine(ApplicationDataDir, "WabiSabiConfig.json");
RuntimeCoordinatorConfig = new(runtimeConfigurationFilePath);
- RuntimeCoordinatorConfig.LoadOrCreateDefaultFile();
+ RuntimeCoordinatorConfig.LoadOrCreateDefaultFile(createDefaultFile: true);
}
/// <summary>

Add optional method parameter