fix suggestion generation to not include identical transaction and not suggest change avoidance if there isnt change.
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacySuggestionsFlyoutViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacySuggestionsFlyoutViewModel.cs
@@ -36,9 +36,6 @@ public partial class PrivacySuggestionsFlyoutViewModel : ViewModelBase
{
IsLoading = true;
- var suggestions =
- await ChangeAvoidanceSuggestionViewModel.GenerateSuggestionsAsync(info, wallet, transaction);
-
Suggestions.Clear();
SelectedSuggestion = null;
@@ -47,10 +44,18 @@ public partial class PrivacySuggestionsFlyoutViewModel : ViewModelBase
Suggestions.Add(new PocketSuggestionViewModel(SmartLabel.Merge(transaction.SpentCoins.Select(x => CoinHelpers.GetLabels(x)))));
}
- foreach (var suggestion in suggestions)
+ var suggestions =
+ await ChangeAvoidanceSuggestionViewModel.GenerateSuggestionsAsync(info, wallet, transaction);
+
+ var hasChange = transaction.InnerWalletOutputs.Any(x => x.ScriptPubKey != info.Address.ScriptPubKey);
+
+ if (hasChange)
+ {
+ foreach (var suggestion in suggestions.Where(x=>x.TransactionResult != transaction))
{
Suggestions.Add(suggestion);
}
+ }
IsLoading = false;
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionPreviewViewModel.cs
@@ -66,11 +66,13 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
PrivacySuggestions.IsOpen = false;
PrivacySuggestions.SelectedSuggestion = null;
- if (x is ChangeAvoidanceSuggestionViewModel changeAvoidance)
+ if (x is ChangeAvoidanceSuggestionViewModel)
{
if (x.TransactionResult is { })
{
UpdateTransaction(CurrentTransactionSummary, x.TransactionResult);
+
+ await PrivacySuggestions.BuildPrivacySuggestionsAsync(_wallet, _info, x.TransactionResult);
}
}
else if (x is PocketSuggestionViewModel)

fix suggestion generation to not include identical transaction and not suggest change avoidance if there isnt change.