From 33f63508e8c4d22aefce99be095d0d2fbdb0036d Mon Sep 17 00:00:00 2001 From: rockstardev Date: Tue, 19 May 2020 16:26:03 -0500 Subject: [PATCH 1/3] Adding setting in checkout experience for inclusion of private route hints --- BTCPayServer/Controllers/StoresController.cs | 2 ++ BTCPayServer/Data/StoreBlob.cs | 1 + .../Models/StoreViewModels/CheckoutExperienceViewModel.cs | 5 ++++- BTCPayServer/Views/Stores/CheckoutExperience.cshtml | 6 ++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/BTCPayServer/Controllers/StoresController.cs b/BTCPayServer/Controllers/StoresController.cs index 2c55ca0ca..bd420f076 100644 --- a/BTCPayServer/Controllers/StoresController.cs +++ b/BTCPayServer/Controllers/StoresController.cs @@ -381,6 +381,7 @@ namespace BTCPayServer.Controllers vm.OnChainMinValue = storeBlob.OnChainMinValue?.ToString() ?? ""; vm.LightningMaxValue = storeBlob.LightningMaxValue?.ToString() ?? ""; vm.LightningAmountInSatoshi = storeBlob.LightningAmountInSatoshi; + vm.LightningPrivateRouteHints = storeBlob.LightningPrivateRouteHints; vm.RedirectAutomatically = storeBlob.RedirectAutomatically; return View(vm); } @@ -441,6 +442,7 @@ namespace BTCPayServer.Controllers blob.OnChainMinValue = onchainMinValue; blob.LightningMaxValue = lightningMaxValue; blob.LightningAmountInSatoshi = model.LightningAmountInSatoshi; + blob.LightningPrivateRouteHints = model.LightningPrivateRouteHints; blob.RedirectAutomatically = model.RedirectAutomatically; if (CurrentStore.SetStoreBlob(blob)) { diff --git a/BTCPayServer/Data/StoreBlob.cs b/BTCPayServer/Data/StoreBlob.cs index 143805d57..c91d313da 100644 --- a/BTCPayServer/Data/StoreBlob.cs +++ b/BTCPayServer/Data/StoreBlob.cs @@ -92,6 +92,7 @@ namespace BTCPayServer.Data [JsonConverter(typeof(CurrencyValueJsonConverter))] public CurrencyValue LightningMaxValue { get; set; } public bool LightningAmountInSatoshi { get; set; } + public bool LightningPrivateRouteHints { get; set; } public string CustomCSS { get; set; } public string CustomLogo { get; set; } diff --git a/BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs b/BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs index ffb14db2c..8d1e789ab 100644 --- a/BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/CheckoutExperienceViewModel.cs @@ -63,7 +63,10 @@ namespace BTCPayServer.Models.StoreViewModels [Display(Name = "Display lightning payment amounts in Satoshis")] public bool LightningAmountInSatoshi { get; set; } - + + [Display(Name = "Add hop hints for private channels to the lightning invoice")] + public bool LightningPrivateRouteHints { get; set; } + [Display(Name = "Redirect invoice to redirect url automatically after paid")] public bool RedirectAutomatically { get; set; } } diff --git a/BTCPayServer/Views/Stores/CheckoutExperience.cshtml b/BTCPayServer/Views/Stores/CheckoutExperience.cshtml index 2542fe1bb..095877590 100644 --- a/BTCPayServer/Views/Stores/CheckoutExperience.cshtml +++ b/BTCPayServer/Views/Stores/CheckoutExperience.cshtml @@ -81,6 +81,12 @@ +
+ + + +
+
From ca3acdacdc7b9085a74faef2524f74c0d90ce45d Mon Sep 17 00:00:00 2001 From: rockstardev Date: Tue, 19 May 2020 16:47:26 -0500 Subject: [PATCH 2/3] Setting PriveRoute hints when creating lightning invoices --- BTCPayServer/BTCPayServer.csproj | 3 ++- .../Payments/Lightning/LightningLikePaymentHandler.cs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index 71d09ccd0..0d2f8c8cc 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -31,7 +31,8 @@ - + + diff --git a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs index 3c388c4ad..b51cf1c52 100644 --- a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs @@ -65,7 +65,9 @@ namespace BTCPayServer.Payments.Lightning { try { - lightningInvoice = await client.CreateInvoice(new LightMoney(due, LightMoneyUnit.BTC), description, expiry, cts.Token); + var request = new CreateInvoiceParams(new LightMoney(due, LightMoneyUnit.BTC), description, expiry); + request.PrivateRouteHints = storeBlob.LightningPrivateRouteHints; + lightningInvoice = await client.CreateInvoice(request, cts.Token); } catch (OperationCanceledException) when (cts.IsCancellationRequested) { From eb5dcab32d1454628e5877b8b63190b912fb33a5 Mon Sep 17 00:00:00 2001 From: rockstardev Date: Tue, 19 May 2020 18:00:35 -0500 Subject: [PATCH 3/3] Upgrading to BTCPayServer.Lightning to 1.1.15 --- BTCPayServer/BTCPayServer.csproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index 0d2f8c8cc..b8898f886 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -31,8 +31,7 @@ - - +