Improve phoenixd, remove support for deprecated lightning backend
What changed, and why it matters
This commit is a routine maintenance update for BTCPay Server. It removes support for three older/deprecated Lightning payment backends (Lightning Charge, LNDHub, and LNBank), updates the phoenixd integration, bumps a couple of library versions, and adjusts tests accordingly. There is no indication in the commit that this fixes an active security vulnerability or introduces new attack paths.
Treat as a normal deprecation/maintenance commit. Operators relying on Lightning Charge, LNDHub, or LNBank should migrate to supported backends (Core Lightning, LND, phoenixd, internal node) before upgrading. Review the BTCPayServer.Lightning 1.7.1 release notes for any security fixes included in the dependency bump.
Security signals we found
Removal of deprecated Lightning backend integrations (Lightning Charge, LNDHub, LNBank)
Dependency bump: BTCPayServer.Lightning.All 1.7.0 -> 1.7.1 and BTCPayServer.Lightning.Common 1.5.3 -> 1.7.1
Change to Lightning node sync validation: now skips the 'blocks behind' check when reported BlockHeight is 0
No explicit security bug fix, CVE reference, or vulnerability disclosure in commit message or diff
Evidence from the diff
The change drops Lightning Charge, LNDHub, and LNBank connection string handlers and their associated client registrations from BTCPayServerServices.cs. It also removes the ChargeTester test helper, migrates tests to a new LightningTestImplementation enum (CoreLightning/LND/Internal), updates BTCPayServer.Lightning.All/Common from 1.7.0/1.5.3 to 1.7.1, and tweaks the LightningLikePaymentHandler sync check to skip the block-height gap test when the backend reports BlockHeight == 0. The Changelog explicitly frames the backend removals as deprecation cleanup.
Changed components
BTCPayServer/Hosting/BTCPayServerServices.csBTCPayServer/Payments/Lightning/LightningLikePaymentHandler.csBTCPayServer/Extensions.csBTCPayServer.Client/BTCPayServer.Client.csprojBTCPayServer/BTCPayServer.csprojBTCPayServer.Tests/*Changelog.mdInspect captured patch +68 / −127
diff --git a/BTCPayServer.Client/BTCPayServer.Client.csproj b/BTCPayServer.Client/BTCPayServer.Client.csproj
index 037f12a..d288106 100644
--- a/BTCPayServer.Client/BTCPayServer.Client.csproj
+++ b/BTCPayServer.Client/BTCPayServer.Client.csproj
@@ -16,7 +16,7 @@
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<PropertyGroup>
- <Version Condition=" '$(Version)' == '' ">2.0.1</Version>
+ <Version Condition=" '$(Version)' == '' ">2.0.2</Version>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PublishRepositoryUrl>true</PublishRepositoryUrl>
@@ -30,7 +30,7 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
- <PackageReference Include="BTCPayServer.Lightning.Common" Version="1.5.3" />
+ <PackageReference Include="BTCPayServer.Lightning.Common" Version="1.7.1" />
<PackageReference Include="NBitcoin" Version="10.0.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
</ItemGroup>
diff --git a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs
index de6f110..24bea2e 100644
--- a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs
+++ b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs
@@ -51,7 +51,7 @@ namespace BTCPayServer.Tests
await user.GrantAccessAsync(true);
user.RegisterDerivationScheme(cryptoCode);
user.RegisterDerivationScheme("LTC");
- user.RegisterLightningNode(cryptoCode, LightningConnectionType.CLightning);
+ user.RegisterLightningNode(cryptoCode, LightningTestImplementation.CoreLightning);
user.SetLNUrl("BTC", false);
var btcNetwork = tester.PayTester.Networks.GetNetwork<BTCPayNetwork>(cryptoCode);
var invoice = await user.BitPay.CreateInvoiceAsync(
diff --git a/BTCPayServer.Tests/ChargeTester.cs b/BTCPayServer.Tests/ChargeTester.cs
deleted file mode 100644
index 0c0665b..0000000
--- a/BTCPayServer.Tests/ChargeTester.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using BTCPayServer.Lightning;
-using BTCPayServer.Lightning.Charge;
-using NBitcoin;
-
-namespace BTCPayServer.Tests
-{
- public class ChargeTester
- {
- private readonly ServerTester _Parent;
-
- public ChargeTester(ServerTester serverTester, string environmentName, string defaultValue, string defaultHost, Network network)
- {
- this._Parent = serverTester;
- var url = serverTester.GetEnvironment(environmentName, defaultValue);
-
- Client = (ChargeClient)new LightningClientFactory(network).Create(url);
- P2PHost = _Parent.GetEnvironment(environmentName + "_HOST", defaultHost);
- }
- public ChargeClient Client { get; set; }
- public string P2PHost { get; }
- }
-}
diff --git a/BTCPayServer.Tests/GreenfieldAPITests.cs b/BTCPayServer.Tests/GreenfieldAPITests.cs
index 83b1f58..dce1b3f 100644
--- a/BTCPayServer.Tests/GreenfieldAPITests.cs
+++ b/BTCPayServer.Tests/GreenfieldAPITests.cs
@@ -3005,7 +3005,7 @@ namespace BTCPayServer.Tests
VerifyLightning(methods);
VerifyOnChain(methods);
- var connStr = tester.GetLightningConnectionString(LightningConnectionType.CLightning, true);
+ var connStr = tester.GetLightningConnectionString(LightningTestImplementation.CoreLightning, true);
await adminClient.UpdateStorePaymentMethod(store.Id, "BTC-LN",
new UpdatePaymentMethodRequest()
{
@@ -3369,7 +3369,7 @@ namespace BTCPayServer.Tests
await admin.GrantAccessAsync(true);
var adminClient = await admin.CreateClient(Policies.Unrestricted);
- admin.RegisterLightningNode("BTC", LightningConnectionType.CLightning);
+ admin.RegisterLightningNode("BTC", LightningTestImplementation.CoreLightning);
var payoutAmount = LightMoney.Satoshis(1000);
var inv = await tester.MerchantLnd.Client.CreateInvoice(payoutAmount, "Donation to merchant", TimeSpan.FromHours(1), default);
var resp = await tester.CustomerLightningD.Pay(inv.BOLT11);
diff --git a/BTCPayServer.Tests/LightningTests.cs b/BTCPayServer.Tests/LightningTests.cs
index c299c02..f718f31 100644
--- a/BTCPayServer.Tests/LightningTests.cs
+++ b/BTCPayServer.Tests/LightningTests.cs
@@ -8,7 +8,6 @@ using BTCPayServer.Client.Models;
using BTCPayServer.Controllers;
using BTCPayServer.Events;
using BTCPayServer.Lightning;
-using BTCPayServer.Lightning.Charge;
using BTCPayServer.Models.StoreViewModels;
using BTCPayServer.Payments;
using BTCPayServer.Payments.Lightning;
@@ -22,6 +21,7 @@ using Xunit;
using static Microsoft.Playwright.Assertions;
using CreateInvoiceRequest = BTCPayServer.Client.Models.CreateInvoiceRequest;
using BTCPayServer.Data;
+using BTCPayServer.Lightning.CLightning;
using LightningAddressData = BTCPayServer.Client.Models.LightningAddressData;
namespace BTCPayServer.Tests;
@@ -40,7 +40,7 @@ public class LightningTests(ITestOutputHelper testOutputHelper) : UnitTestBase(t
await tester.EnsureChannelsSetup();
var user = tester.NewAccount();
await user.GrantAccessAsync(true);
- user.RegisterLightningNode("BTC", LightningConnectionType.CLightning);
+ user.RegisterLightningNode("BTC", LightningTestImplementation.CoreLightning);
var client = await user.CreateClient(Policies.Unrestricted);
var invoices = new Task<Client.Models.InvoiceData>[5];
@@ -103,11 +103,11 @@ public class LightningTests(ITestOutputHelper testOutputHelper) : UnitTestBase(t
await tester.EnsureChannelsSetup();
var user = tester.NewAccount();
await user.GrantAccessAsync(true);
- user.RegisterLightningNode("BTC", LightningConnectionType.CLightning, false);
+ user.RegisterLightningNode("BTC", LightningTestImplementation.CoreLightning, false);
var merchant = tester.NewAccount();
await merchant.GrantAccessAsync(true);
- merchant.RegisterLightningNode("BTC", LightningConnectionType.LndREST);
+ merchant.RegisterLightningNode("BTC", LightningTestImplementation.LND);
var merchantClient = await merchant.CreateClient($"{Policies.CanUseLightningNodeInStore}:{merchant.StoreId}");
var merchantInvoice = await merchantClient.CreateLightningInvoice(merchant.StoreId, "BTC",
new CreateLightningInvoiceRequest(LightMoney.Satoshis(1_000), "hey", TimeSpan.FromSeconds(60)));
@@ -272,7 +272,7 @@ public class LightningTests(ITestOutputHelper testOutputHelper) : UnitTestBase(t
var user = tester.NewAccount();
await user.GrantAccessAsync(true);
- var types = new[] { LightningConnectionType.LndREST, LightningConnectionType.CLightning };
+ var types = new[] { LightningTestImplementation.LND, LightningTestImplementation.CoreLightning };
foreach (var type in types)
{
user.RegisterLightningNode("BTC", type);
@@ -614,7 +614,7 @@ public class LightningTests(ITestOutputHelper testOutputHelper) : UnitTestBase(t
[Trait("Lightning", "Lightning")]
public async Task CanSendLightningPaymentCLightning()
{
- await ProcessLightningPayment(LightningConnectionType.CLightning);
+ await ProcessLightningPayment(LightningTestImplementation.CoreLightning);
}
[Fact(Timeout = 60 * 2 * 1000)]
@@ -622,10 +622,10 @@ public class LightningTests(ITestOutputHelper testOutputHelper) : UnitTestBase(t
[Trait("Lightning", "Lightning")]
public async Task CanSendLightningPaymentLnd()
{
- await ProcessLightningPayment(LightningConnectionType.LndREST);
+ await ProcessLightningPayment(LightningTestImplementation.LND);
}
- async Task ProcessLightningPayment(string type)
+ async Task ProcessLightningPayment(LightningTestImplementation type)
{
// For easier debugging and testing
// LightningLikePaymentHandler.LIGHTNING_TIMEOUT = int.MaxValue;
@@ -681,7 +681,7 @@ public class LightningTests(ITestOutputHelper testOutputHelper) : UnitTestBase(t
var user = tester.NewAccount();
await user.GrantAccessAsync(true);
await user.RegisterDerivationSchemeAsync("BTC");
- await user.RegisterLightningNodeAsync("BTC", LightningConnectionType.CLightning);
+ await user.RegisterLightningNodeAsync("BTC", LightningTestImplementation.CoreLightning);
await user.SetNetworkFeeMode(NetworkFeeMode.Never);
await user.ModifyGeneralSettings(p => p.SpeedPolicy = SpeedPolicy.HighSpeed);
var invoice = await user.BitPay.CreateInvoiceAsync(new Invoice(0.0001m, "BTC"));
@@ -748,9 +748,10 @@ public class LightningTests(ITestOutputHelper testOutputHelper) : UnitTestBase(t
Assert.IsType<ViewResult>(storeResponse);
Assert.IsType<ViewResult>(storeController.SetupLightningNode(user.StoreId, "BTC"));
+ var address = ((CLightningClient)tester.CustomerLightningD).Address.AbsoluteUri;
await storeController.SetupLightningNode(user.StoreId, new LightningNodeViewModel
{
- ConnectionString = $"type=charge;server={tester.MerchantCharge.Client.Uri.AbsoluteUri};allowinsecure=true",
+ ConnectionString = $"type=clightning;server={address}",
SkipPortTest = true // We can't test this as the IP can't be resolved by the test host :(
}, "test", "BTC");
Assert.False(storeController.TempData.ContainsKey(WellKnownTempData.ErrorMessage));
@@ -760,12 +761,12 @@ public class LightningTests(ITestOutputHelper testOutputHelper) : UnitTestBase(t
Assert.IsType<RedirectToActionResult>(await storeController.SetupLightningNode(user.StoreId,
new LightningNodeViewModel
{
- ConnectionString = $"type=charge;server={tester.MerchantCharge.Client.Uri.AbsoluteUri};allowinsecure=true"
+ ConnectionString = $"type=clightning;server={address}"
}, "save", "BTC"));
// Make sure old connection string format does not work
Assert.IsType<RedirectToActionResult>(await storeController.SetupLightningNode(user.StoreId,
- new LightningNodeViewModel { ConnectionString = tester.MerchantCharge.Client.Uri.AbsoluteUri },
+ new LightningNodeViewModel { ConnectionString = address },
"save", "BTC"));
storeResponse = storeController.LightningSettings(user.StoreId, "BTC");
@@ -837,7 +838,7 @@ public class LightningTests(ITestOutputHelper testOutputHelper) : UnitTestBase(t
public async Task CanDoLightningInternalNodeMigration()
{
using var tester = CreateServerTester(newDb: true);
- tester.ActivateLightning(LightningConnectionType.CLightning);
+ tester.ActivateLightning(LightningTestImplementation.CoreLightning);
await tester.StartAsync();
var acc = tester.NewAccount();
await acc.GrantAccessAsync(true);
@@ -864,7 +865,7 @@ public class LightningTests(ITestOutputHelper testOutputHelper) : UnitTestBase(t
Assert.Equal(derivation, v.AccountOriginal);
Assert.Equal(xpub, v.GetFirstAccountKeySettings().AccountKey.ToString());
- await acc.RegisterLightningNodeAsync("BTC", LightningConnectionType.CLightning);
+ await acc.RegisterLightningNodeAsync("BTC", LightningTestImplementation.CoreLightning);
store = await tester.PayTester.StoreRepository.FindStore(acc.StoreId);
pmi = PaymentTypes.LN.GetPaymentMethodId("BTC");
@@ -891,35 +892,6 @@ public class LightningTests(ITestOutputHelper testOutputHelper) : UnitTestBase(t
Assert.Null(conf["connectionString"]); // Null, so should be stripped
Assert.Null(conf["DisableBOLT11PaymentOption"]); // Old garbage cleaned
- // Test if legacy lightning charge settings are converted to LightningConnectionString
- store.DerivationStrategies = new JObject()
- {
- new JProperty("BTC_LightningLike", new JObject()
- {
- new JProperty("LightningChargeUrl", "http://mycharge.com/"),
- new JProperty("Username", "usr"),
- new JProperty("Password", "pass"),
- new JProperty("CryptoCode", "BTC"),
- new JProperty("PaymentId", "someshit"),
- })
- }.ToString();
- await tester.PayTester.StoreRepository.UpdateStore(store);
- await tester.RestartMigration();
- store = await tester.PayTester.StoreRepository.FindStore(acc.StoreId);
- Assert.NotNull(store);
- lnMethod = store.GetPaymentMethodConfig<LightningPaymentMethodConfig>(pmi, handlers);
- Assert.NotNull(lnMethod?.GetExternalLightningUrl());
-
- var url = lnMethod.GetExternalLightningUrl();
- LightningConnectionStringHelper.ExtractValues(url, out var connType);
- Assert.Equal(LightningConnectionType.Charge, connType);
- var client = Assert.IsType<ChargeClient>(tester.PayTester.GetService<LightningClientFactoryService>()
- .Create(url, tester.NetworkProvider.GetNetwork<BTCPayNetwork>("BTC")));
- var auth = Assert.IsType<ChargeAuthentication.UserPasswordAuthentication>(client.ChargeAuthentication);
-
- Assert.Equal("pass", auth.NetworkCredential.Password);
- Assert.Equal("usr", auth.NetworkCredential.UserName);
-
// Test if lightning connection strings get migrated to internal
store.DerivationStrategies = new JObject()
{
diff --git a/BTCPayServer.Tests/PlaywrightTester.cs b/BTCPayServer.Tests/PlaywrightTester.cs
index 0c2e9b9..39696a6 100644
--- a/BTCPayServer.Tests/PlaywrightTester.cs
+++ b/BTCPayServer.Tests/PlaywrightTester.cs
@@ -476,7 +476,7 @@ namespace BTCPayServer.Tests
await FindAlertMessage();
}
- public async Task AddLightningNode(string connectionType = null, bool test = true)
+ public async Task AddLightningNode(LightningTestImplementation connectionType = LightningTestImplementation.Internal, bool test = true)
{
var cryptoCode = "BTC";
if (!(await Page.ContentAsync()).Contains("Connect to a Lightning node"))
@@ -486,9 +486,9 @@ namespace BTCPayServer.Tests
var connectionString = connectionType switch
{
- LightningConnectionType.CLightning =>
+ LightningTestImplementation.CoreLightning =>
$"type=clightning;server={((CLightningClient)Server.MerchantLightningD).Address.AbsoluteUri}",
- LightningConnectionType.LndREST =>
+ LightningTestImplementation.LND =>
$"type=lnd-rest;server={Server.MerchantLnd.Swagger.BaseUrl};allowinsecure=true",
_ => null
};
diff --git a/BTCPayServer.Tests/PlaywrightTests.cs b/BTCPayServer.Tests/PlaywrightTests.cs
index 09e6ba9..fd6871d 100644
--- a/BTCPayServer.Tests/PlaywrightTests.cs
+++ b/BTCPayServer.Tests/PlaywrightTests.cs
@@ -348,7 +348,7 @@ namespace BTCPayServer.Tests
await s.RegisterNewUser(true);
var (_, storeId) = await s.CreateNewStore();
var network = s.Server.NetworkProvider.GetNetwork<BTCPayNetwork>(cryptoCode).NBitcoinNetwork;
- await s.AddLightningNode(LightningConnectionType.CLightning, false);
+ await s.AddLightningNode(LightningTestImplementation.CoreLightning, false);
await s.GoToLightningSettings();
// LNURL is true by default
await Expect(s.Page.Locator("#LNURLEnabled")).ToBeCheckedAsync();
@@ -466,7 +466,7 @@ namespace BTCPayServer.Tests
await s.GoToHome();
var (_, newStoreId) = await s.CreateNewStore(false);
- await s.AddLightningNode(LightningConnectionType.LndREST, false);
+ await s.AddLightningNode(LightningTestImplementation.LND, false);
await s.GoToLightningSettings();
await s.Page.CheckAsync("#LNURLEnabled");
await s.ClickPagePrimary();
@@ -546,7 +546,7 @@ namespace BTCPayServer.Tests
//ensure ln address is not available as Lightning is not enable
Assert.Equal(0, await s.Page.Locator("#menu-item-LightningAddress").CountAsync());
- await s.AddLightningNode(LightningConnectionType.LndREST, false);
+ await s.AddLightningNode(LightningTestImplementation.LND, false);
// Navigate to store to refresh the menu and show Lightning Address
await s.GoToStore(s.StoreId);
@@ -2180,7 +2180,7 @@ namespace BTCPayServer.Tests
var (_, storeId) = await s.CreateNewStore();
await s.GoToStore();
await s.GenerateWallet(isHotWallet: true);
- await s.AddLightningNode(LightningConnectionType.CLightning, false);
+ await s.AddLightningNode(LightningTestImplementation.CoreLightning, false);
// Add apps
await s.CreateApp("PointOfSale");
diff --git a/BTCPayServer.Tests/PullPaymentsTests.cs b/BTCPayServer.Tests/PullPaymentsTests.cs
index df09253..850f47a 100644
--- a/BTCPayServer.Tests/PullPaymentsTests.cs
+++ b/BTCPayServer.Tests/PullPaymentsTests.cs
@@ -42,7 +42,7 @@ public class PullPaymentsTests(ITestOutputHelper helper) : UnitTestBase(helper)
}, e => e.Type == PayoutEvent.PayoutEventType.Created)).Payout;
}
s.Server.DeleteStore = false;
- s.Server.ActivateLightning(LightningConnectionType.LndREST);
+ s.Server.ActivateLightning(LightningTestImplementation.LND);
await s.StartAsync();
await s.Server.EnsureChannelsSetup();
await s.RegisterNewUser(true);
@@ -637,7 +637,7 @@ public class PullPaymentsTests(ITestOutputHelper helper) : UnitTestBase(helper)
await tester.EnsureChannelsSetup();
var acc = tester.NewAccount();
await acc.GrantAccessAsync(true);
- acc.RegisterLightningNode("BTC", LightningConnectionType.CLightning, false);
+ acc.RegisterLightningNode("BTC", LightningTestImplementation.CoreLightning, false);
var storeId = (await acc.RegisterDerivationSchemeAsync("BTC", importKeysToNBX: true)).StoreId;
var client = await acc.CreateClient();
var result = await client.CreatePullPayment(storeId, new CreatePullPaymentRequest()
diff --git a/BTCPayServer.Tests/RolesTests.cs b/BTCPayServer.Tests/RolesTests.cs
index 31012ea..466b92e 100644
--- a/BTCPayServer.Tests/RolesTests.cs
+++ b/BTCPayServer.Tests/RolesTests.cs
@@ -863,7 +863,7 @@ public class RolesTests(ITestOutputHelper testOutputHelper) : UnitTestBase(testO
var (_, storeId) = await s.CreateNewStore();
await s.GoToStore();
await s.GenerateWallet(isHotWallet: true);
- await s.AddLightningNode(LightningConnectionType.CLightning, false);
+ await s.AddLightningNode(LightningTestImplementation.CoreLightning, false);
await s.AddUserToStore(storeId, manager, "Manager");
await s.AddUserToStore(storeId, employee, "Employee");
await s.AddUserToStore(storeId, guest, "Guest");
diff --git a/BTCPayServer.Tests/ServerTester.cs b/BTCPayServer.Tests/ServerTester.cs
index c7850c7..b1046c8 100644
--- a/BTCPayServer.Tests/ServerTester.cs
+++ b/BTCPayServer.Tests/ServerTester.cs
@@ -109,25 +109,24 @@ namespace BTCPayServer.Tests
public void ActivateLightning()
{
- ActivateLightning(LightningConnectionType.CLightning);
+ ActivateLightning(LightningTestImplementation.CoreLightning);
}
- public void ActivateLightning(string internalNode)
+ public void ActivateLightning(LightningTestImplementation internalNode)
{
var btc = NetworkProvider.GetNetwork<BTCPayNetwork>("BTC").NBitcoinNetwork;
var factory = new LightningClientFactory(btc);
CustomerLightningD = factory.Create(GetEnvironment("TEST_CUSTOMERLIGHTNINGD", "type=clightning;server=tcp://127.0.0.1:30992/"));
MerchantLightningD = factory.Create(GetEnvironment("TEST_MERCHANTLIGHTNINGD", "type=clightning;server=tcp://127.0.0.1:30993/"));
- MerchantCharge = new ChargeTester(this, "TEST_MERCHANTCHARGE", "type=charge;server=http://127.0.0.1:54938/;api-token=foiewnccewuify;allowinsecure=true", "merchant_lightningd", btc);
MerchantLnd = new LndMockTester(this, "TEST_MERCHANTLND", "http://lnd:lnd@127.0.0.1:35531/", "merchant_lnd", btc);
PayTester.UseLightning = true;
PayTester.IntegratedLightning = GetLightningConnectionString(internalNode, true);
}
- public string GetLightningConnectionString(string connectionType, bool isMerchant)
+ public string GetLightningConnectionString(LightningTestImplementation connectionType, bool isMerchant)
{
string connectionString = null;
- if (connectionType is null)
+ if (connectionType is LightningTestImplementation.Internal)
return LightningPaymentMethodConfig.InternalNode;
- if (connectionType == LightningConnectionType.CLightning)
+ if (connectionType == LightningTestImplementation.CoreLightning)
{
if (isMerchant)
connectionString = "type=clightning;server=" +
@@ -136,7 +135,7 @@ namespace BTCPayServer.Tests
connectionString = "type=clightning;server=" +
((CLightningClient)CustomerLightningD).Address.AbsoluteUri;
}
- else if (connectionType == LightningConnectionType.LndREST)
+ else if (connectionType == LightningTestImplementation.LND)
{
if (isMerchant)
connectionString = $"type=lnd-rest;server={MerchantLnd.Swagger.BaseUrl};allowinsecure=true";
@@ -144,7 +143,7 @@ namespace BTCPayServer.Tests
throw new NotSupportedException();
}
else
- throw new NotSupportedException(connectionType);
+ throw new NotSupportedException(connectionType.ToString());
return connectionString;
}
@@ -217,7 +216,6 @@ namespace BTCPayServer.Tests
public ILightningClient CustomerLightningD { get; set; }
public ILightningClient MerchantLightningD { get; private set; }
- public ChargeTester MerchantCharge { get; private set; }
public LndMockTester MerchantLnd { get; set; }
internal string GetEnvironment(string variable, string defaultValue)
diff --git a/BTCPayServer.Tests/TestAccount.cs b/BTCPayServer.Tests/TestAccount.cs
index 73237b1..8e492b5 100644
--- a/BTCPayServer.Tests/TestAccount.cs
+++ b/BTCPayServer.Tests/TestAccount.cs
@@ -40,6 +40,13 @@ using Xunit.Sdk;
namespace BTCPayServer.Tests
{
+ public enum LightningTestImplementation
+ {
+ CoreLightning,
+ LND,
+ Internal
+ }
+
public class TestAccount
{
readonly ServerTester parent;
@@ -266,15 +273,15 @@ namespace BTCPayServer.Tests
public bool IsAdmin { get; internal set; }
- public void RegisterLightningNode(string cryptoCode, string connectionType = null, bool isMerchant = true)
+ public void RegisterLightningNode(string cryptoCode, LightningTestImplementation connectionType = LightningTestImplementation.Internal, bool isMerchant = true)
{
RegisterLightningNodeAsync(cryptoCode, connectionType, isMerchant).GetAwaiter().GetResult();
}
public Task RegisterLightningNodeAsync(string cryptoCode, bool isMerchant = true)
{
- return RegisterLightningNodeAsync(cryptoCode, null, isMerchant);
+ return RegisterLightningNodeAsync(cryptoCode, LightningTestImplementation.Internal, isMerchant);
}
- public async Task RegisterLightningNodeAsync(string cryptoCode, string connectionType, bool isMerchant = true)
+ public async Task RegisterLightningNodeAsync(string cryptoCode, LightningTestImplementation connectionType, bool isMerchant = true)
{
var connectionString = parent.GetLightningConnectionString(connectionType, isMerchant);
var client = await this.CreateClient();
diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs
index af91100..3c8718f 100644
--- a/BTCPayServer.Tests/UnitTest1.cs
+++ b/BTCPayServer.Tests/UnitTest1.cs
@@ -1338,7 +1338,7 @@ namespace BTCPayServer.Tests
var cryptoCode = "BTC";
await user.GrantAccessAsync(true);
user.RegisterDerivationScheme(cryptoCode, ScriptPubKeyType.Segwit);
- user.RegisterLightningNode(cryptoCode, LightningConnectionType.CLightning);
+ user.RegisterLightningNode(cryptoCode, LightningTestImplementation.CoreLightning);
var invoice = user.BitPay.CreateInvoice(
new Invoice
diff --git a/BTCPayServer.Tests/docker-compose.altcoins.yml b/BTCPayServer.Tests/docker-compose.altcoins.yml
index d529332..9b4105f 100644
--- a/BTCPayServer.Tests/docker-compose.altcoins.yml
+++ b/BTCPayServer.Tests/docker-compose.altcoins.yml
@@ -384,7 +384,6 @@ volumes:
elementsd_liquid_datadir:
customer_lightningd_datadir:
merchant_lightningd_datadir:
- lightning_charge_datadir:
customer_lnd_datadir:
merchant_lnd_datadir:
postgres_test_datadir:
diff --git a/BTCPayServer.Tests/docker-compose.mutinynet.yml b/BTCPayServer.Tests/docker-compose.mutinynet.yml
index 72b8274..78dd92a 100644
--- a/BTCPayServer.Tests/docker-compose.mutinynet.yml
+++ b/BTCPayServer.Tests/docker-compose.mutinynet.yml
@@ -273,7 +273,6 @@ volumes:
elementsd_liquid_datadir:
customer_lightningd_datadir:
merchant_lightningd_datadir:
- lightning_charge_datadir:
customer_lnd_datadir:
merchant_lnd_datadir:
postgres_test_datadir:
diff --git a/BTCPayServer.Tests/docker-compose.testnet.yml b/BTCPayServer.Tests/docker-compose.testnet.yml
index 0d037e9..c3d54a1 100644
--- a/BTCPayServer.Tests/docker-compose.testnet.yml
+++ b/BTCPayServer.Tests/docker-compose.testnet.yml
@@ -265,7 +265,6 @@ volumes:
elementsd_liquid_datadir:
customer_lightningd_datadir:
merchant_lightningd_datadir:
- lightning_charge_datadir:
customer_lnd_datadir:
merchant_lnd_datadir:
postgres_test_datadir:
diff --git a/BTCPayServer.Tests/docker-compose.yml b/BTCPayServer.Tests/docker-compose.yml
index b1b42db..7cbe61f 100644
--- a/BTCPayServer.Tests/docker-compose.yml
+++ b/BTCPayServer.Tests/docker-compose.yml
@@ -319,7 +319,6 @@ volumes:
elementsd_liquid_datadir:
customer_lightningd_datadir:
merchant_lightningd_datadir:
- lightning_charge_datadir:
customer_lnd_datadir:
merchant_lnd_datadir:
postgres_test_datadir:
diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj
index 41cfe42..4b643d4 100644
--- a/BTCPayServer/BTCPayServer.csproj
+++ b/BTCPayServer/BTCPayServer.csproj
@@ -38,7 +38,7 @@
<PackageReference Include="YamlDotNet" Version="16.3.0" />
<PackageReference Include="BIP78.Sender" Version="0.2.5" />
<PackageReference Include="BTCPayServer.Hwi" Version="2.0.6" />
- <PackageReference Include="BTCPayServer.Lightning.All" Version="1.7.0" />
+ <PackageReference Include="BTCPayServer.Lightning.All" Version="1.7.1" />
<PackageReference Include="CsvHelper" Version="33.1.0" />
<PackageReference Include="Fido2" Version="4.0.1" />
<PackageReference Include="Fido2.AspNet" Version="4.0.1" />
diff --git a/BTCPayServer/Extensions.cs b/BTCPayServer/Extensions.cs
index 159bc0a..a574656 100644
--- a/BTCPayServer/Extensions.cs
+++ b/BTCPayServer/Extensions.cs
@@ -28,6 +28,10 @@ using BTCPayServer.Data;
using BTCPayServer.HostedServices;
using BTCPayServer.Hwi;
using BTCPayServer.Lightning;
+using BTCPayServer.Lightning.CLightning;
+using BTCPayServer.Lightning.Eclair;
+using BTCPayServer.Lightning.LND;
+using BTCPayServer.Lightning.Phoenixd;
using BTCPayServer.Models;
using BTCPayServer.Models.StoreViewModels;
using BTCPayServer.NTag424;
@@ -263,20 +267,18 @@ namespace BTCPayServer
[Obsolete("Use GetDisplayName(this ILightningClient client, string connectionString) instead")]
public static string GetDisplayName(this ILightningClient client) => GetDisplayName(client, client.ToString());
+
public static string GetDisplayName(this ILightningClient client, string connectionString)
- {
- if (client is IExtendedLightningClient { DisplayName: { } displayName })
- return displayName;
- var kv = client.ExtractValues(connectionString);
- if (!kv.TryGetValue("type", out var type))
- return "???";
- var lncType = typeof(LightningConnectionType);
- var fields = lncType.GetFields(BindingFlags.Public | BindingFlags.Static);
- var field = fields.FirstOrDefault(f => f.GetValue(lncType)?.ToString() == type);
- if (field == null) return type;
- DisplayAttribute attr = field.GetCustomAttribute<DisplayAttribute>();
- return attr?.Name ?? type;
- }
+ => client switch
+ {
+ CLightningClient _ => "Core Lightning",
+ LndClient => "LND",
+ EclairLightningClient => "Eclair",
+ PhoenixdLightningClient => "Phoenix",
+ IExtendedLightningClient { DisplayName: { } n } => n,
+ _ when client.ExtractValues(connectionString).TryGetValue("type", out var t) => t,
+ _ => client.GetType().Name
+ };
private static bool TryParseLegacy(string str, out Dictionary<string, string> connectionString)
{
diff --git a/BTCPayServer/Hosting/BTCPayServerServices.cs b/BTCPayServer/Hosting/BTCPayServerServices.cs
index cc4507d..82089d0 100644
--- a/BTCPayServer/Hosting/BTCPayServerServices.cs
+++ b/BTCPayServer/Hosting/BTCPayServerServices.cs
@@ -11,16 +11,12 @@ using BTCPayServer.Configuration;
using BTCPayServer.Controllers;
using BTCPayServer.Data;
using BTCPayServer.Data.Payouts.LightningLike;
-using BTCPayServer.Forms;
using BTCPayServer.HostedServices;
using BTCPayServer.Lightning;
-using BTCPayServer.Lightning.Charge;
using BTCPayServer.Lightning.CLightning;
using BTCPayServer.Lightning.Eclair;
using BTCPayServer.Lightning.Phoenixd;
-using BTCPayServer.Lightning.LNbank;
using BTCPayServer.Lightning.LND;
-using BTCPayServer.Lightning.LNDhub;
using BTCPayServer.Logging;
using BTCPayServer.PaymentRequest;
using BTCPayServer.Payments;
@@ -134,8 +130,6 @@ namespace BTCPayServer.Hosting
services.AddSingleton<ISwaggerProvider, DefaultSwaggerProvider>();
services.TryAddSingleton<SocketFactory>();
- services.AddSingleton<Func<HttpClient, ILightningConnectionStringHandler>>(client =>
- new ChargeLightningConnectionStringHandler(client));
services.AddSingleton<Func<HttpClient, ILightningConnectionStringHandler>>(_ =>
new CLightningConnectionStringHandler());
services.AddSingleton<Func<HttpClient, ILightningConnectionStringHandler>>(client =>
@@ -144,10 +138,6 @@ namespace BTCPayServer.Hosting
new PhoenixdConnectionStringHandler(client));
services.AddSingleton<Func<HttpClient, ILightningConnectionStringHandler>>(client =>
new LndConnectionStringHandler(client));
- services.AddSingleton<Func<HttpClient, ILightningConnectionStringHandler>>(client =>
- new LndHubConnectionStringHandler(client));
- services.AddSingleton<Func<HttpClient, ILightningConnectionStringHandler>>(client =>
- new LNbankConnectionStringHandler(client));
services.TryAddSingleton<LightningClientFactoryService>();
services.AddHttpClient(LightningClientFactoryService.OnionNamedClient)
.ConfigurePrimaryHttpMessageHandler<Socks5HttpClientHandler>();
diff --git a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs
index 26ff827..750eca9 100644
--- a/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs
+++ b/BTCPayServer/Payments/Lightning/LightningLikePaymentHandler.cs
@@ -10,7 +10,6 @@ using BTCPayServer.Configuration;
using BTCPayServer.Data;
using BTCPayServer.HostedServices;
using BTCPayServer.Lightning;
-using BTCPayServer.Lightning.LndHub;
using BTCPayServer.Payments.Bitcoin;
using BTCPayServer.Security;
using BTCPayServer.Services;
@@ -159,10 +158,6 @@ namespace BTCPayServer.Payments.Lightning
using var cts = new CancellationTokenSource(LightningTimeout);
var client = CreateLightningClient(supportedPaymentMethod);
- // LNDhub-compatible implementations might not offer all of GetInfo data.
- // Skip checks in those cases, see https://github.com/lnbits/lnbits/issues/1182
- var isLndHub = client is LndHubLightningClient;
-
LightningNodeInformation info;
try
{
@@ -196,7 +191,8 @@ namespace BTCPayServer.Payments.Lightning
if (summary?.Status is not null)
{
var blocksGap = summary.Status.ChainHeight - info.BlockHeight;
- if (blocksGap > 10 && !(isLndHub && info.BlockHeight == 0))
+ // If BlockHeight is 0, maybe the provider just doesn't support it.
+ if (blocksGap > 10 && info.BlockHeight != 0)
{
throw new PaymentMethodUnavailableException(
$"The lightning node is not synched ({blocksGap} blocks left)");
diff --git a/Changelog.md b/Changelog.md
index 897eaea..d71297e 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -47,6 +47,7 @@
* Remove deprecated Shopify Scripts integration (#6608) @NicolasDorier
* Deprecate LCAD (#7363) @BullishNode
+* Remove support of some lightning backends: Lightning Charge, LNDHub, LNBank.
## 2.3.9
diff --git a/btcpayserver.sln.DotSettings b/btcpayserver.sln.DotSettings
index 7e913dc..ca53910 100644
--- a/btcpayserver.sln.DotSettings
+++ b/btcpayserver.sln.DotSettings
@@ -6,6 +6,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HWI/@EntryIndexedValue">HWI</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IPN/@EntryIndexedValue">IPN</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LN/@EntryIndexedValue">LN</s:String>
+ <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LND/@EntryIndexedValue">LND</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LNURL/@EntryIndexedValue">LNURL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NB/@EntryIndexedValue">NBX</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=NBXplorer/@EntryIndexedValue">NBXplorer</s:String>
Why this scored 22/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.