tx without backend
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendControlViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendControlViewModel.cs
@@ -68,6 +68,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private FeeDisplayFormat _feeDisplayFormat;
private bool _isSliderFeeUsed = true;
private double _feeControlOpacity;
+ private bool _isEstimateAvailable;
protected SendControlViewModel(Wallet wallet, string title)
: base(title)
@@ -209,6 +210,25 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
this.RaisePropertyChanged(nameof(CustomChangeAddress));
});
+ this.WhenAnyValue(x => x.IsEstimateAvailable)
+ .ObserveOn(RxApp.MainThreadScheduler)
+ .Subscribe(_ =>
+ {
+ if (_isEstimateAvailable)
+ {
+ IsCustomFee = Global.UiConfig.IsCustomFee;
+ }
+ else
+ {
+ IsCustomFee = true;
+ }
+ });
+
+ Observable
+ .FromEventPattern<AllFeeEstimate>(Global.FeeProviders, nameof(Global.FeeProviders.AllFeeEstimateChanged))
+ .ObserveOn(RxApp.MainThreadScheduler)
+ .Subscribe(_ => IsEstimateAvailable = true);
+
FeeRateCommand = ReactiveCommand.Create(ChangeFeeRateDisplay, outputScheduler: RxApp.MainThreadScheduler);
OnAddressPasteCommand = ReactiveCommand.Create((BitcoinUrlBuilder url) => OnAddressPaste(url));
@@ -407,6 +427,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
NotificationHelpers.Error(ex.ToUserFriendlyString());
Logger.LogError(ex);
});
+
+ IsEstimateAvailable = Global.FeeProviders.AllFeeEstimate != null;
}
protected Global Global { get; }
@@ -580,6 +602,12 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private set => this.RaiseAndSetIfChanged(ref _isCustomFee, value);
}
+ public bool IsEstimateAvailable
+ {
+ get => _isEstimateAvailable;
+ set => this.RaiseAndSetIfChanged(ref _isEstimateAvailable, value);
+ }
+
public string AmountTip
{
get => _amountTip;
@@ -637,10 +665,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
AllFeeEstimate allFeeEstimate = Global.FeeProviders?.AllFeeEstimate;
- if (allFeeEstimate is { })
- {
int feeTarget = -1; // 1 => 10 minutes
- if (IsSliderFeeUsed)
+ if (IsSliderFeeUsed && IsEstimateAvailable)
{
feeTarget = FeeTarget;
@@ -658,6 +684,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
prevKey = target;
}
+
+ FeeRate = allFeeEstimate.GetFeeRate(feeTarget);
+ UserFeeText = FeeRate.SatoshiPerByte.ToString();
}
else
{
@@ -669,6 +698,9 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
if (TryParseUserFee(UserFeeText, out decimal userFee))
{
FeeRate = new FeeRate(userFee);
+
+ if (IsEstimateAvailable)
+ {
feeTarget = Constants.SevenDaysConfirmationTarget;
foreach (var feeEstimate in allFeeEstimate.Estimations)
{
@@ -682,11 +714,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}
}
-
- if (IsSliderFeeUsed)
- {
- FeeRate = allFeeEstimate.GetFeeRate(feeTarget);
- UserFeeText = FeeRate.SatoshiPerByte.ToString();
}
IEnumerable<SmartCoin> selectedCoins = CoinList.Coins.Where(cvm => cvm.IsSelected).Select(x => x.Model);
@@ -782,7 +809,6 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
}
}
- }
private void SetAmountIfMax()
{
@@ -911,7 +937,7 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
Global.UiConfig.WhenAnyValue(x => x.IsCustomFee)
.ObserveOn(RxApp.MainThreadScheduler)
- .Subscribe(x => IsCustomFee = x)
+ .Subscribe(x => IsCustomFee = x || Global.FeeProviders.AllFeeEstimate == null)
.DisposeWith(disposables);
this.WhenAnyValue(x => x.IsCustomFee)

tx without backend