Use SafeInvoke
MODIFY
WalletWasabi/CoinJoin/Coordinator/Coordinator.cs
WalletWasabi/CoinJoin/Coordinator/Coordinator.cs
@@ -439,6 +439,8 @@ public class Coordinator : IDisposable
}
private async void CoinVerifier_CoinBlackListedAsync(object? _, Coin coin)
+ {
+ try
{
bool bannedAtLeastOne = false;
foreach (var round in Rounds)
@@ -451,10 +453,15 @@ public class Coordinator : IDisposable
}
}
+ // Could be a coin from WW2.
if (!bannedAtLeastOne)
{
await UtxoReferee.BanUtxosAsync(1, DateTimeOffset.UtcNow, forceNoted: false, 0, forceBan: true, coin.Outpoint).ConfigureAwait(false);
- Logger.LogError($"Could not find alice in rounds for coin:'{coin.Outpoint}'. Banned only this coin.");
+ }
+ }
+ catch (Exception ex)
+ {
+ Logger.LogError(ex);
}
}

MODIFY
WalletWasabi/Extensions/EventHandlerExtensions.cs
WalletWasabi/Extensions/EventHandlerExtensions.cs
@@ -4,7 +4,7 @@ namespace WalletWasabi.Extensions;
public static class EventHandlerExtensions
{
- public static void SafeInvoke<T>(this EventHandler<T>? handler, object sender, T args) where T : EventArgs
+ public static void SafeInvoke<T>(this EventHandler<T>? handler, object sender, T args) where T : class
{
try
{

MODIFY
WalletWasabi/WabiSabi/Backend/Banning/CoinVerifier.cs
WalletWasabi/WabiSabi/Backend/Banning/CoinVerifier.cs
@@ -6,6 +6,7 @@ using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Logging;
using WalletWasabi.WabiSabi.Backend.Rounds.CoinJoinStorage;
+using WalletWasabi.Extensions;
namespace WalletWasabi.WabiSabi.Backend.Banning;
@@ -207,7 +208,7 @@ public class CoinVerifier
// We got a definetive answer.
if (shouldBan)
{
- CoinBlackListed?.Invoke(this, coin);
+ CoinBlackListed?.SafeInvoke(this, coin);
}
else
{

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
@@ -638,6 +638,8 @@ public partial class Arena : PeriodicRunner
{
// For logging reason Prison needs the roundId.
var roundState = RoundStates.FirstOrDefault(rs => rs.CoinjoinState.Inputs.Any(input => input.Outpoint == coin.Outpoint));
+
+ // Cound be a coin from WW1.
var roundId = roundState?.Id ?? uint256.Zero;
Prison.Ban(coin.Outpoint, roundId, isLongBan: true);
}

Use SafeInvoke