Raise events directly wherever it makes sense.
MODIFY
WalletWasabi/ChaumianCoinJoin/CcjRound.cs
WalletWasabi/ChaumianCoinJoin/CcjRound.cs
@@ -66,14 +66,13 @@ namespace WalletWasabi.ChaumianCoinJoin
if (_phase != value)
{
_phase = value;
- OnPhaseChanged(value);
+ PhaseChanged?.Invoke(this, value);
}
}
}
}
public event EventHandler<CcjRoundPhase> PhaseChanged;
- private void OnPhaseChanged(CcjRoundPhase phase) => PhaseChanged?.Invoke(this, phase);
private CcjRoundStatus _status;
@@ -95,14 +94,13 @@ namespace WalletWasabi.ChaumianCoinJoin
if (_status != value)
{
_status = value;
- OnStatusChanged(value);
+ StatusChanged?.Invoke(this, value);
}
}
}
}
public event EventHandler<CcjRoundStatus> StatusChanged;
- private void OnStatusChanged(CcjRoundStatus status) => StatusChanged?.Invoke(this, status);
public TimeSpan AliceRegistrationTimeout => ConnectionConfirmationTimeout;

MODIFY
WalletWasabi/Services/CcjClient.cs
WalletWasabi/Services/CcjClient.cs
@@ -38,12 +38,11 @@ namespace WalletWasabi.Services
if (_registrableRoundState != value)
{
_registrableRoundState = value;
- OnRegistrableRoundStateChanged(value);
+ RegistrableRoundStateChanged?.Invoke(this, value);
}
}
}
public event EventHandler<CcjRunningRoundState> RegistrableRoundStateChanged;
- private void OnRegistrableRoundStateChanged(CcjRunningRoundState state) => RegistrableRoundStateChanged?.Invoke(this, state);
private long _frequentStatusProcessingIfNotMixing;

MODIFY
WalletWasabi/Services/IndexBuilderService.cs
WalletWasabi/Services/IndexBuilderService.cs
@@ -28,7 +28,6 @@ namespace WalletWasabi.Services
private List<ActionHistoryHelper> Bech32UtxoSetHistory { get; }
public event EventHandler<Block> NewBlock;
- private void OnNewBlock(Block block) => NewBlock?.Invoke(this, block);
private class ActionHistoryHelper
{
@@ -228,7 +227,7 @@ namespace WalletWasabi.Services
if (blockCount - height <= 2)
{
- OnNewBlock(block);
+ NewBlock?.Invoke(this, block);
}
if (prevHash != null)

MODIFY
WalletWasabi/Services/IndexDownloader.cs
WalletWasabi/Services/IndexDownloader.cs
@@ -31,10 +31,8 @@ namespace WalletWasabi.Services
public Height StartingHeight => GetStartingHeight(Network);
public event EventHandler<uint256> Reorged;
- private void OnReorg(uint256 invalidBlockHash) => Reorged?.Invoke(this, invalidBlockHash);
public event EventHandler<FilterModel> NewFilter;
- private void OnNewFilter(FilterModel filter) => NewFilter?.Invoke(this, filter);
public static FilterModel GetStartingFilter(Network network)
{
@@ -144,7 +142,7 @@ namespace WalletWasabi.Services
var filterModel = FilterModel.FromLine(filters[i], bestKnownFilter.BlockHeight + i + 1);
Index.Add(filterModel);
- OnNewFilter(filterModel);
+ NewFilter?.Invoke(this, filterModel);
}
if (filters.Count == 1) // minor optimization
@@ -172,7 +170,7 @@ namespace WalletWasabi.Services
Index.RemoveAt(Index.Count - 1);
}
- OnReorg(reorgedHash);
+ Reorged?.Invoke(this, reorgedHash);
// 2. Serialize Index. (Remove last line.)
var lines = File.ReadAllLines(IndexFilePath);

MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -43,7 +43,6 @@ namespace WalletWasabi.Services
public ConcurrentHashSet<SmartCoin> Coins { get; }
public event EventHandler<FilterModel> NewFilterProcessed;
- private void OnNewFilterProcessed(FilterModel filter) => NewFilterProcessed?.Invoke(this, filter);
/// <summary>
/// 0: Not started, 1: Running, 2: Stopping, 3: Stopped
@@ -140,7 +139,7 @@ namespace WalletWasabi.Services
await ProcessFilterModelAsync(filterModel, CancellationToken.None);
}
}
- OnNewFilterProcessed(filterModel);
+ NewFilterProcessed?.Invoke(this, filterModel);
}
public async Task InitializeAsync(CancellationToken cancel)

Raise events directly wherever it makes sense.