reset coins only if selected cluster is not enough
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/SendViewModel.cs
@@ -116,14 +116,7 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
NextCommand = ReactiveCommand.Create(() =>
{
- var amount = new Money(AmountBtc, MoneyUnit.BTC);
-
- if (_transactionInfo.Amount != amount)
- {
- _transactionInfo.ResetAmountSpecificOptions();
- }
-
- _transactionInfo.Amount = amount;
+ _transactionInfo.Amount = new Money(AmountBtc, MoneyUnit.BTC);
Navigate().To(new TransactionPreviewViewModel(wallet, _transactionInfo));
}, nextCommandCanExecute);

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionInfo.cs
WalletWasabi.Fluent/ViewModels/Wallets/Send/TransactionInfo.cs
@@ -2,29 +2,32 @@ using System;
using System.Collections.Generic;
using System.Linq;
using NBitcoin;
+using ReactiveUI;
using WalletWasabi.Blockchain.Analysis.Clustering;
using WalletWasabi.Blockchain.TransactionOutputs;
-using WalletWasabi.Fluent.Helpers;
using WalletWasabi.Wallets;
using WalletWasabi.WebClients.PayJoin;
namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
{
- public class TransactionInfo
+ public partial class TransactionInfo
{
private readonly int _privateCoinThreshold;
+ [AutoNotify] private Money _amount = Money.Zero;
+
public TransactionInfo(Wallet wallet)
{
_privateCoinThreshold = wallet.ServiceConfiguration.GetMixUntilAnonymitySetValue();
+
+ this.WhenAnyValue(x => x.Amount)
+ .Subscribe(_ => OnAmountChanged());
}
public SmartLabel UserLabels { get; set; }
public BitcoinAddress Address { get; set; }
- public Money Amount { get; set; }
-
public FeeRate? FeeRate { get; set; }
public TimeSpan ConfirmationTimeSpan { get; set; }
@@ -39,11 +42,15 @@ namespace WalletWasabi.Fluent.ViewModels.Wallets.Send
public bool SubtractFee { get; set; }
- public void ResetAmountSpecificOptions()
+ private void OnAmountChanged()
{
SubtractFee = default;
- Coins = Enumerable.Empty<SmartCoin>();
FeeRate = default;
+
+ if (Coins.Sum(x => x.Amount) < Amount) // Reset coins if the selected cluster is not enough for the new amount
+ {
+ Coins = Enumerable.Empty<SmartCoin>();
+ }
}
}
}

reset coins only if selected cluster is not enough