fix Sanity check bypassed bug
MODIFY
WalletWasabi/WabiSabi/Client/CoinJoinClient.cs
WalletWasabi/WabiSabi/Client/CoinJoinClient.cs
@@ -210,11 +210,13 @@ public class CoinJoinClient
var (wereAllOutputsRegistered, outputTxOuts) = await ProceedWithOutputRegistrationPhaseAsync(roundId, registeredAliceClients, cancellationToken).ConfigureAwait(false);
- var aliceClientsToSign = wereAllOutputsRegistered
- ? registeredAliceClients
- : registeredAliceClients.RemoveAt(SecureRandom.GetInt(0, registeredAliceClients.Length));
+ if (!wereAllOutputsRegistered)
+ {
+ // We continue and the sanity check will catch it.
+ roundState.LogWarning("Failed to register all the outputs.");
+ }
- var unsignedCoinJoin = await ProceedWithSigningStateAsync(roundId, aliceClientsToSign, outputTxOuts, cancellationToken).ConfigureAwait(false);
+ var (unsignedCoinJoin, aliceClientsToSign) = await ProceedWithSigningStateAsync(roundId, registeredAliceClients, outputTxOuts, cancellationToken).ConfigureAwait(false);
roundState.LogDebug($"{aliceClientsToSign.Length} out of {registeredAliceClients.Length} Alices have signed the coinjoin tx.");
roundState = await RoundStatusUpdater.CreateRoundAwaiter(s => s.Id == roundId && s.Phase == Phase.Ended, cancellationToken).ConfigureAwait(false);
@@ -691,7 +693,7 @@ public class CoinJoinClient
return (wereAllOutputsRegistered, registeredOutputs);
}
- private async Task<Transaction> ProceedWithSigningStateAsync(uint256 roundId, ImmutableArray<AliceClient> aliceClientsToSign, IEnumerable<TxOut> outputTxOuts, CancellationToken cancellationToken)
+ private async Task<(Transaction UnsignedCoinJoin, ImmutableArray<AliceClient> AliceClientsToSign)> ProceedWithSigningStateAsync(uint256 roundId, ImmutableArray<AliceClient> aliceClients, IEnumerable<TxOut> outputTxOuts, CancellationToken cancellationToken)
{
// Signing.
var roundState = await RoundStatusUpdater.CreateRoundAwaiter(roundId, Phase.TransactionSigning, cancellationToken).ConfigureAwait(false);
@@ -719,11 +721,14 @@ public class CoinJoinClient
roundState.LogInfo($"There are missing outputs. A subset of inputs will be signed.");
}
+ var aliceClientsToSign = mustSignAllInputs
+ ? aliceClients
+ : aliceClients.RemoveAt(SecureRandom.GetInt(0, aliceClients.Length));
+
// Send signature.
var combinedToken = linkedCts.Token;
-
await SignTransactionAsync(aliceClientsToSign, unsignedCoinJoin, signingStateEndTime, combinedToken).ConfigureAwait(false);
- return unsignedCoinJoin;
+ return (unsignedCoinJoin, aliceClientsToSign);
}
private async Task<ImmutableArray<(AliceClient, PersonCircuit)>> ProceedWithInputRegAndConfirmAsync(IEnumerable<SmartCoin> smartCoins, RoundState roundState, CancellationToken cancellationToken)

MODIFY
WalletWasabi/WabiSabi/LoggerTools.cs
WalletWasabi/WabiSabi/LoggerTools.cs
@@ -47,6 +47,11 @@ public static class LoggerTools
Log(roundState, LogLevel.Debug, logMessage, callerFilePath: callerFilePath, callerMemberName: callerMemberName, callerLineNumber: callerLineNumber);
}
+ public static void LogWarning(this RoundState roundState, string logMessage, [CallerFilePath] string callerFilePath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
+ {
+ Log(roundState, LogLevel.Warning, logMessage, callerFilePath: callerFilePath, callerMemberName: callerMemberName, callerLineNumber: callerLineNumber);
+ }
+
public static void Log(this Wallet wallet, LogLevel logLevel, string logMessage, [CallerFilePath] string callerFilePath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
{
Logger.Log(logLevel, $"Wallet ({wallet.WalletName}): {logMessage}", callerFilePath: callerFilePath, callerMemberName: callerMemberName, callerLineNumber: callerLineNumber);

fix Sanity check bypassed bug