Better equality
MODIFY
WalletWasabi.Fluent/ViewModels/CoinJoinProfiles/CoinJoinProfileViewModelBase.cs
WalletWasabi.Fluent/ViewModels/CoinJoinProfiles/CoinJoinProfileViewModelBase.cs
@@ -9,4 +9,24 @@ public abstract class CoinJoinProfileViewModelBase : ViewModelBase
public virtual int AnonScoreTarget { get; } = 5;
public abstract int FeeRateMedianTimeFrameHours { get; }
+
+ public override bool Equals(object? obj)
+ {
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+
+ if (obj is not CoinJoinProfileViewModelBase profile)
+ {
+ return false;
+ }
+
+ return profile.AnonScoreTarget == AnonScoreTarget && profile.FeeRateMedianTimeFrameHours == FeeRateMedianTimeFrameHours;
+ }
+
+ public override int GetHashCode()
+ {
+ return HashCode.Combine(AnonScoreTarget, FeeRateMedianTimeFrameHours);
+ }
}

MODIFY
WalletWasabi.Fluent/ViewModels/CoinJoinProfiles/PrivateCoinJoinProfileViewModel.cs
WalletWasabi.Fluent/ViewModels/CoinJoinProfiles/PrivateCoinJoinProfileViewModel.cs
@@ -4,6 +4,9 @@ namespace WalletWasabi.Fluent.ViewModels.CoinJoinProfiles;
internal class PrivateCoinJoinProfileViewModel : CoinJoinProfileViewModelBase
{
+ public const int MinAnonScore = 50;
+ public const int MaxAnonScore = 101;
+
public PrivateCoinJoinProfileViewModel(int anonScoreTarget)
{
AnonScoreTarget = anonScoreTarget;
@@ -11,7 +14,7 @@ internal class PrivateCoinJoinProfileViewModel : CoinJoinProfileViewModelBase
public PrivateCoinJoinProfileViewModel()
{
- AnonScoreTarget = GetRandom(50, 101);
+ AnonScoreTarget = GetRandom(MinAnonScore, MaxAnonScore);
}
public override string Title => "Maximize Privacy";
@@ -26,4 +29,19 @@ internal class PrivateCoinJoinProfileViewModel : CoinJoinProfileViewModelBase
{
return SecureRandom.Instance.GetInt(minInclusive, maxExclusive);
}
+
+ public override bool Equals(object? obj)
+ {
+ if (ReferenceEquals(this, obj))
+ {
+ return true;
+ }
+
+ if (obj is not CoinJoinProfileViewModelBase profile)
+ {
+ return false;
+ }
+
+ return profile.AnonScoreTarget < MaxAnonScore && profile.AnonScoreTarget > MinAnonScore && profile.FeeRateMedianTimeFrameHours == FeeRateMedianTimeFrameHours;
+ }
}

Better equality