Add fee calculations
MODIFY
WalletWasabi.Backend/CcjRoundConfig.cs
WalletWasabi.Backend/CcjRoundConfig.cs
@@ -20,14 +20,22 @@ namespace WalletWasabi.Backend
[JsonConverter(typeof(MoneyConverter))]
public Money Denomination { get; private set; }
+ [JsonProperty(PropertyName = "ConfirmationTarget")]
+ public int? ConfirmationTarget { get; private set; }
+
+ [JsonProperty(PropertyName = "CoordinatorFeePercent")]
+ public decimal? CoordinatorFeePercent { get; private set; }
+
public CcjRoundConfig()
{
}
- public CcjRoundConfig(Money denomination)
+ public CcjRoundConfig(Money denomination, int? confirmationTarget, decimal? coordinatorFeePercent)
{
Denomination = Guard.NotNull(nameof(denomination), denomination);
+ ConfirmationTarget = Guard.NotNull(nameof(confirmationTarget), confirmationTarget);
+ CoordinatorFeePercent = Guard.NotNull(nameof(coordinatorFeePercent), coordinatorFeePercent);
}
public async Task ToFileAsync(string path)
@@ -45,6 +53,8 @@ namespace WalletWasabi.Backend
if (string.IsNullOrWhiteSpace(path)) throw new ArgumentException(nameof(path));
Denomination = new Money(0.1m, MoneyUnit.BTC);
+ ConfirmationTarget = 144; // 1 day
+ CoordinatorFeePercent = 0.1m;
if (!File.Exists(path))
{
@@ -56,6 +66,8 @@ namespace WalletWasabi.Backend
var config = JsonConvert.DeserializeObject<CcjRoundConfig>(jsonString);
Denomination = config.Denomination ?? Denomination;
+ ConfirmationTarget = config.ConfirmationTarget ?? ConfirmationTarget;
+ CoordinatorFeePercent = config.CoordinatorFeePercent ?? CoordinatorFeePercent;
}
await ToFileAsync(path);
@@ -75,6 +87,14 @@ namespace WalletWasabi.Backend
{
return true;
}
+ if (ConfirmationTarget != config.ConfirmationTarget)
+ {
+ return true;
+ }
+ if (CoordinatorFeePercent != config.CoordinatorFeePercent)
+ {
+ return true;
+ }
return false;
}

MODIFY
WalletWasabi.Backend/CcjRoundConfigWatcher.cs
WalletWasabi.Backend/CcjRoundConfigWatcher.cs
@@ -57,7 +57,7 @@ namespace WalletWasabi.Backend
await RoundConfig.LoadOrCreateDefaultFileAsync(RoundConfigFilePath);
- await Coordinator.StartNewRoundAsync(RoundConfig.Denomination);
+ await Coordinator.StartNewRoundAsync(Global.RpcClient, RoundConfig.Denomination, (int)RoundConfig.ConfirmationTarget, (decimal) RoundConfig.CoordinatorFeePercent);
}
}
catch (TaskCanceledException ex)

MODIFY
WalletWasabi.Backend/Global.cs
WalletWasabi.Backend/Global.cs
@@ -99,7 +99,7 @@ namespace WalletWasabi.Backend
IndexBuilderService.Synchronize();
Coordinator = new CcjCoordinator();
- await Coordinator.StartNewRoundAsync(RoundConfig.Denomination);
+ await Coordinator.StartNewRoundAsync(RpcClient, RoundConfig.Denomination, (int)RoundConfig.ConfirmationTarget, (decimal)RoundConfig.CoordinatorFeePercent);
RoundConfigWatcher = new CcjRoundConfigWatcher(RoundConfig, RoundConfigFilePath, Coordinator);
RoundConfigWatcher.Start(TimeSpan.FromSeconds(10)); // Every 10 seconds check the config

Add fee calculations