Add mixinglock to the stopasync function and handle if the coin somehow magically disappear, before we want to remove it.
MODIFY
WalletWasabi/Services/CcjClient.cs
WalletWasabi/Services/CcjClient.cs
@@ -458,6 +458,9 @@ namespace WalletWasabi.Services
}
Stop?.Dispose();
+
+ using (await MixLock.LockAsync())
+ {
SatoshiClient?.Dispose();
State.DisposeAllAliceClients();
@@ -466,7 +469,10 @@ namespace WalletWasabi.Services
try
{
var coin = State.GetSingleOrDefaultFromWaitingList(coinReference);
- if (coin == null) throw new NotSupportedException("This is impossible.");
+ if (coin == null)
+ {
+ continue; // The coin isn't present anymore. Good. This should never happen though.
+ }
await DequeueCoinsFromMixAsync(coin);
}
catch (Exception ex)
@@ -489,3 +495,4 @@ namespace WalletWasabi.Services
}
}
}
+}

Add mixinglock to the stopasync function and handle if the coin somehow magically disappear, before we want to remove it.