Fix save CoinJoin
MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
@@ -46,6 +46,8 @@ public partial class Arena : PeriodicRunner
private CoinJoinTransactionArchiver? TransactionArchiver { get; }
public InMemoryCoinJoinIdStore InMemoryCoinJoinIdStore { get; }
+ public event EventHandler<Transaction>? CoinJoinBroadcast;
+
protected override async Task ActionAsync(CancellationToken cancel)
{
using (await AsyncLock.LockAsync(cancel).ConfigureAwait(false))
@@ -244,11 +246,11 @@ public partial class Arena : PeriodicRunner
Config.MakeNextCoordinatorScriptDirty();
}
- InMemoryCoinJoinIdStore.Add(coinjoin.GetHash());
-
round.SetPhase(Phase.Ended);
-
round.LogInfo($"Successfully broadcast the CoinJoin: {coinjoin.GetHash()}.");
+
+ InMemoryCoinJoinIdStore.Add(coinjoin.GetHash());
+ CoinJoinBroadcast?.Invoke(this, coinjoin);
}
else if (round.TransactionSigningTimeFrame.HasExpired)
{

MODIFY
WalletWasabi/WabiSabi/Models/CoordinationFeeRate.cs
WalletWasabi/WabiSabi/Models/CoordinationFeeRate.cs
@@ -10,7 +10,7 @@ public struct CoordinationFeeRate
public CoordinationFeeRate(decimal rate, Money plebsDontPayThreshold)
{
Rate = Guard.InRangeAndNotNull(nameof(rate), rate, 0m, 0.01m);
- PlebsDontPayThreshold = plebsDontPayThreshold;
+ PlebsDontPayThreshold = plebsDontPayThreshold ?? Money.Zero;
}
public decimal Rate { get; }

MODIFY
WalletWasabi/WabiSabi/WabiSabiCoordinator.cs
WalletWasabi/WabiSabi/WabiSabiCoordinator.cs
@@ -28,6 +28,7 @@ public class WabiSabiCoordinator : BackgroundService
var inMemoryCoinJoinIdStore = InMemoryCoinJoinIdStore.LoadFromFile(parameters.CoinJoinIdStoreFilePath);
Arena = new(parameters.RoundProgressSteppingPeriod, rpc.Network, Config, rpc, Warden.Prison, inMemoryCoinJoinIdStore, transactionArchiver);
+ Arena.CoinJoinBroadcast += Arena_CoinJoinBroadcast;
}
public ConfigWatcher ConfigWatcher { get; }
@@ -38,6 +39,16 @@ public class WabiSabiCoordinator : BackgroundService
public WabiSabiConfig Config => Parameters.RuntimeCoordinatorConfig;
+ private void Arena_CoinJoinBroadcast(object? sender, Transaction e)
+ {
+ if (!File.Exists(Parameters.CoinJoinIdStoreFilePath))
+ {
+ IoHelpers.EnsureContainingDirectoryExists(Parameters.CoinJoinIdStoreFilePath);
+ }
+
+ File.AppendAllLines(Parameters.CoinJoinIdStoreFilePath, new[] { e.GetHash().ToString() });
+ }
+
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await ConfigWatcher.StartAsync(stoppingToken).ConfigureAwait(false);
@@ -56,6 +67,7 @@ public class WabiSabiCoordinator : BackgroundService
public override void Dispose()
{
+ Arena.CoinJoinBroadcast -= Arena_CoinJoinBroadcast;
ConfigWatcher.Dispose();
Warden.Dispose();
base.Dispose();

Fix save CoinJoin