Add WasiSabi CoinJoin monitor to status request API
MODIFY
WalletWasabi.Backend/Controllers/BlockchainController.cs
WalletWasabi.Backend/Controllers/BlockchainController.cs
@@ -352,7 +352,7 @@ public class BlockchainController : ControllerBase
status.FilterCreationActive = true;
}
- // Updating the status of coinjoin
+ // Updating the status of coinjoin.
var validInterval = TimeSpan.FromSeconds(Global.Coordinator.RoundConfig.InputRegistrationTimeout * 2);
if (validInterval < TimeSpan.FromHours(1))
{
@@ -363,6 +363,20 @@ public class BlockchainController : ControllerBase
status.CoinJoinCreationActive = true;
}
+ // Updating the status of WabiSabi coinjoin.
+ if (Global.WabiSabiCoordinator is { } wabiSabiCoordinator)
+ {
+ var wabiSabiValidInterval = wabiSabiCoordinator.Config.StandardInputRegistrationTimeout * 2;
+ if (wabiSabiValidInterval < TimeSpan.FromHours(1))
+ {
+ wabiSabiValidInterval = TimeSpan.FromHours(1);
+ }
+ if (DateTimeOffset.UtcNow - wabiSabiCoordinator.LastSuccessfulCoinJoinTime < wabiSabiValidInterval)
+ {
+ status.WabiSabiCoinJoinCreationActive = true;
+ }
+ }
+
return status;
}
}

MODIFY
WalletWasabi.Backend/Global.cs
WalletWasabi.Backend/Global.cs
@@ -44,6 +44,7 @@ public class Global : IDisposable
public CoordinatorRoundConfig RoundConfig { get; private set; }
public CoinJoinIdStore CoinJoinIdStore { get; private set; }
+ public WabiSabiCoordinator? WabiSabiCoordinator { get; private set; }
public async Task InitializeAsync(Config config, CoordinatorRoundConfig roundConfig, IRPCClient rpc, CancellationToken cancel)
{
@@ -92,7 +93,8 @@ public class Global : IDisposable
CoinJoinIdStore = CoinJoinIdStore.Create(Coordinator.CoinJoinsFilePath, coordinatorParameters.CoinJoinIdStoreFilePath);
- HostedServices.Register<WabiSabiCoordinator>(() => new WabiSabiCoordinator(coordinatorParameters, RpcClient, CoinJoinIdStore), "WabiSabi Coordinator");
+ WabiSabiCoordinator = new WabiSabiCoordinator(coordinatorParameters, RpcClient, CoinJoinIdStore);
+ HostedServices.Register<WabiSabiCoordinator>(() => WabiSabiCoordinator, "WabiSabi Coordinator");
HostedServices.Register<RoundBootstrapper>(() => new RoundBootstrapper(TimeSpan.FromMilliseconds(100), Coordinator), "Round Bootstrapper");
await HostedServices.StartAllAsync(cancel);

MODIFY
WalletWasabi/Backend/Models/Responses/StatusResponse.cs
WalletWasabi/Backend/Models/Responses/StatusResponse.cs
@@ -4,4 +4,5 @@ public class StatusResponse
{
public bool FilterCreationActive { get; set; }
public bool CoinJoinCreationActive { get; set; }
+ public bool WabiSabiCoinJoinCreationActive { get; set; }
}

MODIFY
WalletWasabi/WabiSabi/WabiSabiCoordinator.cs
WalletWasabi/WabiSabi/WabiSabiCoordinator.cs
@@ -57,9 +57,12 @@ public class WabiSabiCoordinator : BackgroundService
public CoinJoinFeeRateStatStore CoinJoinFeeRateStatStore { get; }
public WabiSabiConfig Config => Parameters.RuntimeCoordinatorConfig;
+ public DateTimeOffset LastSuccessfulCoinJoinTime { get; private set; } = DateTimeOffset.UtcNow;
private void Arena_CoinJoinBroadcast(object? sender, Transaction transaction)
{
+ LastSuccessfulCoinJoinTime = DateTimeOffset.UtcNow;
+
CoinJoinIdStore.TryAdd(transaction.GetHash());
var coinJoinScriptStoreFilePath = Parameters.CoinJoinScriptStoreFilePath;

Add WasiSabi CoinJoin monitor to status request API