Fix minimum required issue.
Resolve
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
@@ -32,6 +32,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private Money _amountQueued;
private string _warningMessageEnqueue;
private string _warningMessageDequeue;
+ private const int PreSelectMaxAnonSetExcludingCondition = 50;
public CoinJoinTabViewModel(WalletViewModel walletViewModel)
: base("CoinJoin", walletViewModel)
@@ -50,29 +51,29 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
var registrableRound = Global.ChaumianClient.State.GetRegistrableRoundOrDefault();
- if (!(registrableRound?.State?.Denomination is null) && registrableRound.State.Denomination != Money.Zero)
+ UpdateRequiredBtcLabel(registrableRound, available, queued);
+
+ if (registrableRound != default)
{
- AvailableCoinsList = new CoinListViewModel(available, registrableRound.State.Denomination, 50);
+ CoordinatorFeePercent = registrableRound.State.CoordinatorFeePercent.ToString();
}
else
{
- AvailableCoinsList = new CoinListViewModel(available);
+ CoordinatorFeePercent = "0.003";
}
- if (registrableRound != default)
+ if (!(registrableRound?.State?.Denomination is null) && registrableRound.State.Denomination != Money.Zero)
{
- CoordinatorFeePercent = registrableRound.State.CoordinatorFeePercent.ToString();
- RequiredBTC = registrableRound.State.CalculateRequiredAmount(Global.ChaumianClient.State.GetAllQueuedCoinAmounts().ToArray());
+ AvailableCoinsList = new CoinListViewModel(available, RequiredBTC, PreSelectMaxAnonSetExcludingCondition);
}
else
{
- CoordinatorFeePercent = "0.003";
- RequiredBTC = Money.Zero;
+ AvailableCoinsList = new CoinListViewModel(available);
}
QueuedCoinsList = new CoinListViewModel(queued);
- AmountQueued = Global.ChaumianClient.State.SumAllQueuedCoinAmounts();
+ AmountQueued = Money.Zero;// Global.ChaumianClient.State.SumAllQueuedCoinAmounts();
Global.ChaumianClient.CoinQueued += ChaumianClient_CoinQueued;
Global.ChaumianClient.CoinDequeued += ChaumianClient_CoinDequeued;
@@ -203,7 +204,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
if (registrableRound != default)
{
CoordinatorFeePercent = registrableRound.State.CoordinatorFeePercent.ToString();
- RequiredBTC = registrableRound.State.CalculateRequiredAmount(Global.ChaumianClient.State.GetAllQueuedCoinAmounts().ToArray());
+ UpdateRequiredBtcLabel(registrableRound, AvailableCoinsList.Coins, QueuedCoinsList.Coins);
}
var mostAdvancedRound = Global.ChaumianClient.State.GetMostAdvancedRoundOrDefault();
if (mostAdvancedRound != default)
@@ -215,6 +216,38 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}
+#pragma warning disable CS0618 // Type or member is obsolete
+
+ private void UpdateRequiredBtcLabel(CcjClientRound registrableRound, IReactiveDerivedList<CoinViewModel> available, IReactiveDerivedList<CoinViewModel> queued)
+#pragma warning restore CS0618 // Type or member is obsolete
+ {
+ if (registrableRound == default)
+ {
+ if (RequiredBTC == default)
+ {
+ RequiredBTC = Money.Zero;
+ }
+ }
+ else
+ {
+ if (queued != default && queued.Any())
+ {
+ RequiredBTC = registrableRound.State.CalculateRequiredAmount(Global.ChaumianClient.State.GetAllQueuedCoinAmounts().ToArray());
+ }
+ else
+ {
+ if (available != default && available.Any())
+ {
+ RequiredBTC = registrableRound.State.CalculateRequiredAmount(available.Where(x => x.AnonymitySet < PreSelectMaxAnonSetExcludingCondition).Select(x => x.Model.Amount).ToArray());
+ }
+ else
+ {
+ RequiredBTC = registrableRound.State.CalculateRequiredAmount();
+ }
+ }
+ }
+ }
+
public override void OnSelected()
{
Global.ChaumianClient.ActivateFrequentStatusProcessing();

MODIFY
WalletWasabi.Gui/Converters/MoneyStringConverter.cs
WalletWasabi.Gui/Converters/MoneyStringConverter.cs
@@ -15,6 +15,10 @@ namespace WalletWasabi.Gui.Converters
{
return money.ToString(fplus: false, trimExcessZero: true);
}
+ else if (value is null)
+ {
+ return "0";
+ }
throw new InvalidOperationException();
}

MODIFY
WalletWasabi/Backend/Models/Responses/CcjRunningRoundState.cs
WalletWasabi/Backend/Models/Responses/CcjRunningRoundState.cs
@@ -54,7 +54,9 @@ namespace WalletWasabi.Backend.Models.Responses
public Money CalculateRequiredAmount(params Money[] queuedCoinAmounts)
{
var tried = new List<Money>();
- Money baseMinimum = Denomination + (Denomination.Percentange(CoordinatorFeePercent) * RequiredPeerCount) + (FeePerOutputs * 2);
+ Money baseMinimum = Denomination + (FeePerOutputs * 2);// + (Denomination.Percentange(CoordinatorFeePercent) * RequiredPeerCount);
+ if (queuedCoinAmounts != default)
+ {
foreach (Money amount in queuedCoinAmounts.OrderByDescending(x => x))
{
tried.Add(amount);
@@ -64,14 +66,19 @@ namespace WalletWasabi.Backend.Models.Responses
return required;
}
}
+ }
- return baseMinimum + (FeePerInputs * MaximumInputCountPerPeer);
+ return baseMinimum + FeePerInputs;
+ //return baseMinimum + (FeePerInputs * MaximumInputCountPerPeer);
}
public bool HaveEnoughQueued(params Money[] queuedCoinAmounts)
{
var tried = new List<Money>();
- Money baseMinimum = Denomination + (Denomination.Percentange(CoordinatorFeePercent) * RequiredPeerCount) + (FeePerOutputs * 2);
+ Money baseMinimum = Denomination + (FeePerOutputs * 2);// + (Denomination.Percentange(CoordinatorFeePercent) * RequiredPeerCount);
+
+ if (queuedCoinAmounts != default)
+ {
foreach (Money amount in queuedCoinAmounts.OrderByDescending(x => x))
{
tried.Add(amount);
@@ -85,6 +92,7 @@ namespace WalletWasabi.Backend.Models.Responses
return false;
}
}
+ }
return false;
}

Fix minimum required issue.
Resolve https://github.com/zkSNACKs/WalletWasabi/issues/757