From 36630d9586dca92041e6a450704128978341d589 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Sun, 24 May 2020 21:11:33 +0900 Subject: [PATCH] Randomize RBF if the user does not care --- .../Controllers/WalletsController.PSBT.cs | 5 +++- .../WalletViewModels/WalletSendModel.cs | 10 +++++-- BTCPayServer/Views/Wallets/WalletSend.cshtml | 26 ++++++++++++------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/BTCPayServer/Controllers/WalletsController.PSBT.cs b/BTCPayServer/Controllers/WalletsController.PSBT.cs index 7009697a4..3cfb8aa6e 100644 --- a/BTCPayServer/Controllers/WalletsController.PSBT.cs +++ b/BTCPayServer/Controllers/WalletsController.PSBT.cs @@ -40,7 +40,10 @@ namespace BTCPayServer.Controllers if (network.SupportRBF) { - psbtRequest.RBF = !sendModel.DisableRBF; + if (sendModel.AllowFeeBump is WalletSendModel.ThreeStateBool.Yes) + psbtRequest.RBF = true; + if (sendModel.AllowFeeBump is WalletSendModel.ThreeStateBool.No) + psbtRequest.RBF = false; } psbtRequest.FeePreference = new FeePreference(); diff --git a/BTCPayServer/Models/WalletViewModels/WalletSendModel.cs b/BTCPayServer/Models/WalletViewModels/WalletSendModel.cs index fd8dfce4a..7a1ef367c 100644 --- a/BTCPayServer/Models/WalletViewModels/WalletSendModel.cs +++ b/BTCPayServer/Models/WalletViewModels/WalletSendModel.cs @@ -7,6 +7,12 @@ namespace BTCPayServer.Models.WalletViewModels { public class WalletSendModel { + public enum ThreeStateBool + { + Maybe, + Yes, + No + } public class FeeRateOption { public TimeSpan Target { get; set; } @@ -45,8 +51,8 @@ namespace BTCPayServer.Models.WalletViewModels public string Fiat { get; set; } public string RateError { get; set; } public bool SupportRBF { get; set; } - [Display(Name = "Disable RBF")] - public bool DisableRBF { get; set; } + [Display(Name = "Allow fee increase (RBF)")] + public ThreeStateBool AllowFeeBump { get; set; } public bool NBXSeedAvailable { get; set; } [Display(Name = "PayJoin Endpoint Url")] diff --git a/BTCPayServer/Views/Wallets/WalletSend.cshtml b/BTCPayServer/Views/Wallets/WalletSend.cshtml index 5ead64e11..07d0fbaa0 100644 --- a/BTCPayServer/Views/Wallets/WalletSend.cshtml +++ b/BTCPayServer/Views/Wallets/WalletSend.cshtml @@ -171,21 +171,27 @@
-
- - - - - +
+
+ + + + + +
@if (Model.SupportRBF) { -
- - - +
+ + +
} @if (!string.IsNullOrEmpty(Model.PayJoinEndpointUrl))