Startig and Started events
MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
WalletWasabi/WabiSabi/Client/CoinJoinManager.cs
@@ -96,6 +96,7 @@ public class CoinJoinManager : BackgroundService
{
if (openedWallet.ElapsedTimeSinceStartup <= AutoCoinJoinDelayAfterWalletLoaded)
{
+ NotifyCoinJoinStarting(openedWallet);
continue;
}
if (!openedWallet.KeyManager.AutoCoinJoin)
@@ -124,6 +125,8 @@ public class CoinJoinManager : BackgroundService
CoinJoinTracker coinJoinTracker = coinJoinTrackerFactory.CreateAndStart(openedWallet, coinCandidates);
trackedCoinJoins.Add(openedWallet.WalletName, coinJoinTracker);
+ var registrationTimeout = TimeSpan.MaxValue;
+ NotifyCoinJoinStarted(openedWallet, registrationTimeout);
WalletStatusChanged?.Invoke(this, new WalletStatusChangedEventArgs(openedWallet, IsCoinJoining: true));
}
@@ -195,6 +198,13 @@ public class CoinJoinManager : BackgroundService
}
}
+ private void NotifyCoinJoinStarting(Wallet openedWallet) =>
+ StatusChanged?.Invoke(this, new StartingEventArgs(
+ openedWallet,
+ AutoCoinJoinDelayAfterWalletLoaded - openedWallet.ElapsedTimeSinceStartup));
+
+ private void NotifyCoinJoinStarted(Wallet openedWallet, TimeSpan registrationTimeout) =>
+ StatusChanged?.Invoke(this, new StartedEventArgs(openedWallet, registrationTimeout));
private void NotifyCoinJoinStartError(Wallet openedWallet, CoinjoinError error) =>
StatusChanged?.Invoke(this, new StartErrorEventArgs(openedWallet, error));
@@ -202,7 +212,7 @@ public class CoinJoinManager : BackgroundService
StatusChanged?.Invoke(this, new StoppedEventArgs(closedWallet.Wallet, StopReason.WalletUnloaded));
private void NotifyMixableWalletLoaded(Wallet openedWallet) =>
- StatusChanged?.Invoke(this, new LoadedEventArgs(openedWallet, AutoCoinJoinDelayAfterWalletLoaded));
+ StatusChanged?.Invoke(this, new LoadedEventArgs(openedWallet));
private void NotifyCoinJoinCompletion(CoinJoinTracker finishedCoinJoin) =>
StatusChanged?.Invoke(this, new CoinJoinCompletedEventArgs(

MODIFY
WalletWasabi/WabiSabi/Client/StatusChangedEventArgs.cs
WalletWasabi/WabiSabi/Client/StatusChangedEventArgs.cs
@@ -4,62 +4,71 @@ namespace WalletWasabi.WabiSabi.Client;
public class StatusChangedEventArgs : EventArgs
{
- public Wallet Wallet { get; }
-
public StatusChangedEventArgs(Wallet wallet)
{
Wallet = wallet;
}
+ public Wallet Wallet { get; }
}
public class LoadedEventArgs : StatusChangedEventArgs
{
- public TimeSpan AutoStartDelay { get; }
- public LoadedEventArgs(Wallet wallet, TimeSpan autoStartDelay)
+ public LoadedEventArgs(Wallet wallet)
+ : base(wallet)
+ {
+ }
+}
+
+public class StartingEventArgs : StatusChangedEventArgs
+{
+ public StartingEventArgs(Wallet wallet, TimeSpan startingIn)
: base(wallet)
{
- AutoStartDelay = autoStartDelay;
+ StartingIn = startingIn;
}
+ public TimeSpan StartingIn { get; }
}
public class StartedEventArgs : StatusChangedEventArgs
{
- public StartedEventArgs(Wallet wallet)
+ public StartedEventArgs(Wallet wallet, TimeSpan registrationTimeout)
: base(wallet)
{
+ RegistrationTimeout = registrationTimeout;
}
+
+ public TimeSpan RegistrationTimeout { get; }
}
public class CoinJoinCompletedEventArgs : StatusChangedEventArgs
{
- public CompletionStatus CompletionStatus { get; }
-
public CoinJoinCompletedEventArgs(Wallet wallet, CompletionStatus completionStatus)
: base(wallet)
{
CompletionStatus = completionStatus;
}
+ public CompletionStatus CompletionStatus { get; }
}
public class StoppedEventArgs : StatusChangedEventArgs
{
- public StopReason Reason { get; }
public StoppedEventArgs(Wallet wallet, StopReason reason)
: base(wallet)
{
Reason = reason;
}
+ public StopReason Reason { get; }
}
public class StartErrorEventArgs : StatusChangedEventArgs
{
- public CoinjoinError Error;
public StartErrorEventArgs(Wallet wallet, CoinjoinError error)
: base(wallet)
{
Error = error;
}
+ public CoinjoinError Error;
}
public enum StopReason

Startig and Started events