Fix test and improve logic even more
MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinClient.cs
WalletWasabi/WabiSabi/Client/CoinJoinClient.cs
@@ -291,19 +291,26 @@ public class CoinJoinClient
catch (WabiSabiProtocolException wpe)
{
if (wpe.ErrorCode == WabiSabiProtocolErrorCode.WrongPhase)
+ {
+ if (wpe.ExceptionData is WrongPhaseExceptionData wrongPhaseExceptionData)
+ {
+ if (wrongPhaseExceptionData.CurrentPhase != Phase.InputRegistration)
{
// Cancel all remaining pending input registrations because they will arrive late too.
registrationsCts.Cancel();
- if (wpe.ExceptionData is WrongPhaseExceptionData wrongPhaseExceptionData)
- {
if (wrongPhaseExceptionData.CurrentPhase != Phase.ConnectionConfirmation)
{
+ // Cancel all remaining pending connection confirmations because they will arrive late too.
confirmationsCts.Cancel();
}
}
+ }
else
{
+ // Something's wrong, cancel everything.
+ registrationsCts.Cancel();
+ confirmationsCts.Cancel();
throw new InvalidOperationException(
$"Unexpected condition. {nameof(WrongPhaseException)} doesn't contain a {nameof(WrongPhaseExceptionData)} data field.");
}

Fix test and improve logic even more