fix logic for `SetUsedLabel()`
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/LabelSelectionViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/LabelSelectionViewModel.cs
@@ -162,17 +162,16 @@ public partial class LabelSelectionViewModel : ViewModelBase
this.RaisePropertyChanged(nameof(LabelsBlackList));
}
- public void SetUsedLabel(IEnumerable<SmartCoin>? usedCoins)
+ public void SetUsedLabel(IEnumerable<SmartCoin>? usedCoins, int privateThreshold)
{
if (usedCoins is null)
{
return;
}
- var usedPockets = AllPockets.Where(pocket => pocket.Coins.Any(usedCoins.Contains)).ToArray();
- var notUsedPockets = AllPockets.Except(usedPockets);
- var notUsedPocketsLabels = SmartLabel.Merge(notUsedPockets.Select(x => x.Labels));
- var notUsedLabelViewModels = AllLabelsViewModel.Where(x => notUsedPocketsLabels.Contains(x.Value)).ToArray();
+ var usedLabels = SmartLabel.Merge(usedCoins.Select(x => x.GetLabels(privateThreshold)));
+ var usedLabelViewModels = AllLabelsViewModel.Where(x => usedLabels.Contains(x.Value)).ToArray();
+ var notUsedLabelViewModels = AllLabelsViewModel.Except(usedLabelViewModels);
foreach (LabelViewModel label in notUsedLabelViewModels)
{

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacyControlViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/PrivacyControlViewModel.cs
@@ -45,8 +45,10 @@ public partial class PrivacyControlViewModel : DialogViewModelBase<IEnumerable<S
private void InitializeLabels()
{
- LabelSelection.Reset(_wallet.Coins.GetPockets(_wallet.KeyManager.MinAnonScoreTarget).Select(x => new Pocket(x)).ToArray());
- LabelSelection.SetUsedLabel(_usedCoins);
+ var privateThreshold = _wallet.KeyManager.MinAnonScoreTarget;
+
+ LabelSelection.Reset(_wallet.Coins.GetPockets(privateThreshold).Select(x => new Pocket(x)).ToArray());
+ LabelSelection.SetUsedLabel(_usedCoins, privateThreshold);
}
protected override void OnNavigatedTo(bool isInHistory, CompositeDisposable disposables)

fix logic for `SetUsedLabel()`