Deconstruct variable declarations in library project
MODIFY
WalletWasabi/Blockchain/Transactions/TransactionStore.cs
WalletWasabi/Blockchain/Transactions/TransactionStore.cs
@@ -76,12 +76,12 @@ namespace WalletWasabi.Blockchain.Transactions
{
foreach (var tx in allTransactions)
{
- var res = TryAddOrUpdateNoLockNoSerialization(tx);
- if (res.isAdded)
+ var (isAdded, isUpdated) = TryAddOrUpdateNoLockNoSerialization(tx);
+ if (isAdded)
{
added = true;
}
- if (res.isUpdated)
+ if (isUpdated)
{
updated = true;
}

MODIFY
WalletWasabi/CoinJoin/Client/Clients/CoinJoinClient.cs
WalletWasabi/CoinJoin/Client/Clients/CoinJoinClient.cs
@@ -307,10 +307,10 @@ namespace WalletWasabi.CoinJoin.Client.Clients
{
if (!ongoingRound.Registration.IsPhaseActionsComleted(RoundPhase.ConnectionConfirmation)) // If we did not already confirm connection in connection confirmation phase confirm it.
{
- var res = await ongoingRound.Registration.AliceClient.PostConfirmationAsync().ConfigureAwait(false);
- if (res.activeOutputs.Any())
+ var (currentPhase, activeOutputs) = await ongoingRound.Registration.AliceClient.PostConfirmationAsync().ConfigureAwait(false);
+ if (activeOutputs.Any())
{
- ongoingRound.Registration.ActiveOutputs = res.activeOutputs;
+ ongoingRound.Registration.ActiveOutputs = activeOutputs;
}
ongoingRound.Registration.SetPhaseCompleted(RoundPhase.ConnectionConfirmation);
}
@@ -361,12 +361,12 @@ namespace WalletWasabi.CoinJoin.Client.Clients
minAmountBack -= networkFees; // Minus miner fee.
IOrderedEnumerable<(Money value, int count)> indistinguishableOutputs = unsignedCoinJoin.GetIndistinguishableOutputs(includeSingle: false).OrderByDescending(x => x.count);
- foreach ((Money value, int count) denomPair in indistinguishableOutputs)
+ foreach ((Money value, int count) in indistinguishableOutputs)
{
- var mineCount = myOutputs.Count(x => x.Value == denomPair.value);
+ var mineCount = myOutputs.Count(x => x.Value == value);
- Money denomination = denomPair.value;
- int anonset = Math.Min(110, denomPair.count); // https://github.com/zkSNACKs/WalletWasabi/issues/1379
+ Money denomination = value;
+ int anonset = Math.Min(110, count); // https://github.com/zkSNACKs/WalletWasabi/issues/1379
Money expectedCoordinatorFee = denomination.Percentage(ongoingRound.State.CoordinatorFeePercent * anonset);
for (int i = 0; i < mineCount; i++)
{
@@ -464,17 +464,17 @@ namespace WalletWasabi.CoinJoin.Client.Clients
{
try
{
- var res = await inputRegistrableRound.Registration.AliceClient.PostConfirmationAsync().ConfigureAwait(false);
+ var (currentPhase, activeOutputs) = await inputRegistrableRound.Registration.AliceClient.PostConfirmationAsync().ConfigureAwait(false);
- if (res.activeOutputs.Any())
+ if (activeOutputs.Any())
{
- inputRegistrableRound.Registration.ActiveOutputs = res.activeOutputs;
+ inputRegistrableRound.Registration.ActiveOutputs = activeOutputs;
}
- if (res.currentPhase > RoundPhase.InputRegistration) // Then the phase went to connection confirmation (probably).
+ if (currentPhase > RoundPhase.InputRegistration) // Then the phase went to connection confirmation (probably).
{
inputRegistrableRound.Registration.SetPhaseCompleted(RoundPhase.ConnectionConfirmation);
- inputRegistrableRound.State.Phase = res.currentPhase;
+ inputRegistrableRound.State.Phase = currentPhase;
}
}
catch (Exception ex)

MODIFY
WalletWasabi/CoinJoin/Coordinator/Coordinator.cs
WalletWasabi/CoinJoin/Coordinator/Coordinator.cs
@@ -71,20 +71,20 @@ namespace WalletWasabi.CoinJoin.Coordinator
batch.SendBatchAsync().GetAwaiter().GetResult();
- foreach (var task in getTxTasks)
+ foreach (var (txTask, line) in getTxTasks)
{
try
{
- var tx = task.txTask.GetAwaiter().GetResult();
+ var tx = txTask.GetAwaiter().GetResult();
CoinJoins.Add(tx.GetHash());
}
catch (Exception ex)
{
- toRemove.Add(task.line);
+ toRemove.Add(line);
var logEntry = ex is RPCException rpce && rpce.RPCCode == RPCErrorCode.RPC_INVALID_ADDRESS_OR_KEY
- ? $"CoinJoins file contains invalid transaction ID {task.line}"
- : $"CoinJoins file got corrupted. Deleting offending line \"{task.line.Substring(0, 20)}\".";
+ ? $"CoinJoins file contains invalid transaction ID {line}"
+ : $"CoinJoins file got corrupted. Deleting offending line \"{line.Substring(0, 20)}\".";
Logger.LogWarning($"{logEntry}. {ex.GetType()}: {ex.Message}");
}

MODIFY
WalletWasabi/CoinJoin/Coordinator/Rounds/CoordinatorRound.cs
WalletWasabi/CoinJoin/Coordinator/Rounds/CoordinatorRound.cs
@@ -1156,9 +1156,9 @@ namespace WalletWasabi.CoinJoin.Coordinator.Rounds
Logger.LogInfo($"Round ({RoundId}): Number of outputs: {CoinJoin.Outputs.Count}.");
Logger.LogInfo($"Round ({RoundId}): Serialized Size: {CoinJoin.GetSerializedSize() / 1024} KB.");
Logger.LogInfo($"Round ({RoundId}): VSize: {CoinJoin.GetVirtualSize() / 1024} KB.");
- foreach (var o in CoinJoin.GetIndistinguishableOutputs(includeSingle: false))
+ foreach (var (value, count) in CoinJoin.GetIndistinguishableOutputs(includeSingle: false))
{
- Logger.LogInfo($"Round ({RoundId}): There are {o.count} occurrences of {o.value.ToString(true, false)} BTC output.");
+ Logger.LogInfo($"Round ({RoundId}): There are {count} occurrences of {value.ToString(true, false)} BTC output.");
}
await RpcClient.SendRawTransactionAsync(CoinJoin).ConfigureAwait(false);
@@ -1335,10 +1335,10 @@ namespace WalletWasabi.CoinJoin.Coordinator.Rounds
await batch.SendBatchAsync().ConfigureAwait(false);
- foreach (var t in checkingTasks)
+ foreach (var (alice, task) in checkingTasks)
{
- var resp = await t.task.ConfigureAwait(false);
- responses.Add((t.alice, resp));
+ var resp = await task.ConfigureAwait(false);
+ responses.Add((alice, resp));
}
}

MODIFY
WalletWasabi/Io/DigestableSafeIoManager.cs
WalletWasabi/Io/DigestableSafeIoManager.cs
@@ -60,15 +60,15 @@ namespace WalletWasabi.Io
ContinueBuildHash(byteArrayBuilder, line);
}
- var res = await WorkWithHashAsync(byteArrayBuilder, cancellationToken).ConfigureAwait(false);
- if (res.same)
+ var (same, hash) = await WorkWithHashAsync(byteArrayBuilder, cancellationToken).ConfigureAwait(false);
+ if (same)
{
return;
}
await base.WriteAllLinesAsync(lines, cancellationToken).ConfigureAwait(false);
- await WriteOutHashAsync(res.hash).ConfigureAwait(false);
+ await WriteOutHashAsync(hash).ConfigureAwait(false);
}
public new async Task AppendAllLinesAsync(IEnumerable<string> lines, CancellationToken cancellationToken = default)
@@ -137,14 +137,14 @@ namespace WalletWasabi.Io
await sw.FlushAsync().ConfigureAwait(false);
}
- var res = await WorkWithHashAsync(byteArrayBuilder, cancellationToken).ConfigureAwait(false);
- if (res.same)
+ var (same, hash) = await WorkWithHashAsync(byteArrayBuilder, cancellationToken).ConfigureAwait(false);
+ if (same)
{
return;
}
SafeMoveNewToOriginal();
- await WriteOutHashAsync(res.hash).ConfigureAwait(false);
+ await WriteOutHashAsync(hash).ConfigureAwait(false);
}
#endregion IoOperations

MODIFY
WalletWasabi/WebClients/Wasabi/WasabiClient.cs
WalletWasabi/WebClients/Wasabi/WasabiClient.cs
@@ -240,10 +240,10 @@ namespace WalletWasabi.WebClients.Wasabi
public async Task<UpdateStatus> CheckUpdatesAsync(CancellationToken cancel)
{
- var versions = await GetVersionsAsync(cancel).ConfigureAwait(false);
- var clientUpToDate = Helpers.Constants.ClientVersion >= versions.ClientVersion; // If the client version locally is greater than or equal to the backend's reported client version, then good.
- var backendCompatible = int.Parse(Helpers.Constants.ClientSupportBackendVersionMax) >= versions.BackendMajorVersion && versions.BackendMajorVersion >= int.Parse(Helpers.Constants.ClientSupportBackendVersionMin); // If ClientSupportBackendVersionMin <= backend major <= ClientSupportBackendVersionMax, then our software is compatible.
- var currentBackendMajorVersion = versions.BackendMajorVersion;
+ var (ClientVersion, BackendMajorVersion, LegalDocumentsVersion) = await GetVersionsAsync(cancel).ConfigureAwait(false);
+ var clientUpToDate = Helpers.Constants.ClientVersion >= ClientVersion; // If the client version locally is greater than or equal to the backend's reported client version, then good.
+ var backendCompatible = int.Parse(Helpers.Constants.ClientSupportBackendVersionMax) >= BackendMajorVersion && BackendMajorVersion >= int.Parse(Helpers.Constants.ClientSupportBackendVersionMin); // If ClientSupportBackendVersionMin <= backend major <= ClientSupportBackendVersionMax, then our software is compatible.
+ var currentBackendMajorVersion = BackendMajorVersion;
if (backendCompatible)
{
@@ -251,7 +251,7 @@ namespace WalletWasabi.WebClients.Wasabi
ApiVersion = currentBackendMajorVersion;
}
- return new UpdateStatus(backendCompatible, clientUpToDate, versions.LegalDocumentsVersion, currentBackendMajorVersion);
+ return new UpdateStatus(backendCompatible, clientUpToDate, LegalDocumentsVersion, currentBackendMajorVersion);
}
#endregion software

Deconstruct variable declarations in library project