From 7b96f960253376f6414b2767df10b2ede59fb7b7 Mon Sep 17 00:00:00 2001 From: Nicolas Dorier Date: Tue, 16 May 2023 09:17:21 +0900 Subject: [PATCH] bump clightning (#4970) * bump clightning * Remove Lightning Charge from our tests --- .../AltcoinTests/AltcoinTests.cs | 2 +- BTCPayServer.Tests/GreenfieldAPITests.cs | 33 ++++------------- BTCPayServer.Tests/SeleniumTester.cs | 2 - BTCPayServer.Tests/ServerTester.cs | 11 +----- BTCPayServer.Tests/TestAccount.cs | 2 +- BTCPayServer.Tests/UnitTest1.cs | 12 +----- .../docker-compose.altcoins.yml | 37 +++++-------------- BTCPayServer.Tests/docker-compose.yml | 37 +++++-------------- BTCPayServer/BTCPayServer.csproj | 2 +- 9 files changed, 33 insertions(+), 105 deletions(-) diff --git a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs index 9e88cbfff..ddcfdf5fe 100644 --- a/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs +++ b/BTCPayServer.Tests/AltcoinTests/AltcoinTests.cs @@ -245,7 +245,7 @@ namespace BTCPayServer.Tests await tester.EnsureChannelsSetup(); var user = tester.NewAccount(); user.GrantAccess(true); - user.RegisterLightningNode("BTC", LightningConnectionType.Charge); + user.RegisterLightningNode("BTC"); user.RegisterDerivationScheme("BTC"); user.RegisterDerivationScheme("LTC"); diff --git a/BTCPayServer.Tests/GreenfieldAPITests.cs b/BTCPayServer.Tests/GreenfieldAPITests.cs index be97fef24..72a57ccea 100644 --- a/BTCPayServer.Tests/GreenfieldAPITests.cs +++ b/BTCPayServer.Tests/GreenfieldAPITests.cs @@ -2442,27 +2442,10 @@ namespace BTCPayServer.Tests Assert.NotNull(merchantInvoice.PaymentHash); Assert.Equal(merchantInvoice.Id, merchantInvoice.PaymentHash); - // The default client is using charge, so we should not be able to query channels - var chargeClient = await user.CreateClient(Policies.CanUseInternalLightningNode); - - var info = await chargeClient.GetLightningNodeInfo("BTC"); - Assert.Single(info.NodeURIs); - Assert.NotEqual(0, info.BlockHeight); - Assert.NotNull(info.Alias); - Assert.NotNull(info.Color); - Assert.NotNull(info.Version); - Assert.NotNull(info.PeersCount); - Assert.NotNull(info.ActiveChannelsCount); - Assert.NotNull(info.InactiveChannelsCount); - Assert.NotNull(info.PendingChannelsCount); - - var gex = await AssertAPIError("lightning-node-unavailable", () => chargeClient.ConnectToLightningNode("BTC", new ConnectToNodeRequest(NodeInfo.Parse($"{new Key().PubKey.ToHex()}@localhost:3827")))); - Assert.Contains("NotSupported", gex.Message); - - await AssertAPIError("lightning-node-unavailable", () => chargeClient.GetLightningNodeChannels("BTC")); + var client = await user.CreateClient(Policies.CanUseInternalLightningNode); // Not permission for the store! - await AssertAPIError("missing-permission", () => chargeClient.GetLightningNodeChannels(user.StoreId, "BTC")); - var invoiceData = await chargeClient.CreateLightningInvoice("BTC", new CreateLightningInvoiceRequest() + await AssertAPIError("missing-permission", () => client.GetLightningNodeChannels(user.StoreId, "BTC")); + var invoiceData = await client.CreateLightningInvoice("BTC", new CreateLightningInvoiceRequest() { Amount = LightMoney.Satoshis(1000), Description = "lol", @@ -2470,17 +2453,17 @@ namespace BTCPayServer.Tests PrivateRouteHints = false }); var chargeInvoice = invoiceData; - Assert.NotNull(await chargeClient.GetLightningInvoice("BTC", invoiceData.Id)); + Assert.NotNull(await client.GetLightningInvoice("BTC", invoiceData.Id)); // check list for internal node - var invoices = await chargeClient.GetLightningInvoices("BTC"); - var pendingInvoices = await chargeClient.GetLightningInvoices("BTC", true); + var invoices = await client.GetLightningInvoices("BTC"); + var pendingInvoices = await client.GetLightningInvoices("BTC", true); Assert.NotEmpty(invoices); Assert.Contains(invoices, i => i.Id == invoiceData.Id); Assert.NotEmpty(pendingInvoices); Assert.Contains(pendingInvoices, i => i.Id == invoiceData.Id); - var client = await user.CreateClient($"{Policies.CanUseLightningNodeInStore}:{user.StoreId}"); + client = await user.CreateClient($"{Policies.CanUseLightningNodeInStore}:{user.StoreId}"); // Not permission for the server await AssertAPIError("missing-permission", () => client.GetLightningNodeChannels("BTC")); @@ -2559,7 +2542,7 @@ namespace BTCPayServer.Tests Assert.Contains(payments, i => i.BOLT11 == merchantInvoice.BOLT11); // Node info - info = await client.GetLightningNodeInfo(user.StoreId, "BTC"); + var info = await client.GetLightningNodeInfo(user.StoreId, "BTC"); Assert.Single(info.NodeURIs); Assert.NotEqual(0, info.BlockHeight); diff --git a/BTCPayServer.Tests/SeleniumTester.cs b/BTCPayServer.Tests/SeleniumTester.cs index ee620217b..f71d29e4a 100644 --- a/BTCPayServer.Tests/SeleniumTester.cs +++ b/BTCPayServer.Tests/SeleniumTester.cs @@ -313,8 +313,6 @@ namespace BTCPayServer.Tests var connectionString = connectionType switch { - LightningConnectionType.Charge => - $"type=charge;server={Server.MerchantCharge.Client.Uri.AbsoluteUri};allowinsecure=true", LightningConnectionType.CLightning => $"type=clightning;server={((CLightningClient)Server.MerchantLightningD).Address.AbsoluteUri}", LightningConnectionType.LndREST => diff --git a/BTCPayServer.Tests/ServerTester.cs b/BTCPayServer.Tests/ServerTester.cs index bbc66d34d..efa6821e4 100644 --- a/BTCPayServer.Tests/ServerTester.cs +++ b/BTCPayServer.Tests/ServerTester.cs @@ -92,7 +92,7 @@ namespace BTCPayServer.Tests #endif public void ActivateLightning() { - ActivateLightning(LightningConnectionType.Charge); + ActivateLightning(LightningConnectionType.CLightning); } public void ActivateLightning(LightningConnectionType internalNode) { @@ -109,14 +109,7 @@ namespace BTCPayServer.Tests string connectionString = null; if (connectionType is null) return LightningSupportedPaymentMethod.InternalNode; - if (connectionType == LightningConnectionType.Charge) - { - if (isMerchant) - connectionString = $"type=charge;server={MerchantCharge.Client.Uri.AbsoluteUri};allowinsecure=true"; - else - throw new NotSupportedException(); - } - else if (connectionType == LightningConnectionType.CLightning) + if (connectionType == LightningConnectionType.CLightning) { if (isMerchant) connectionString = "type=clightning;server=" + diff --git a/BTCPayServer.Tests/TestAccount.cs b/BTCPayServer.Tests/TestAccount.cs index 374b1d503..170c81241 100644 --- a/BTCPayServer.Tests/TestAccount.cs +++ b/BTCPayServer.Tests/TestAccount.cs @@ -277,7 +277,7 @@ namespace BTCPayServer.Tests public bool IsAdmin { get; internal set; } - public void RegisterLightningNode(string cryptoCode, LightningConnectionType connectionType, bool isMerchant = true) + public void RegisterLightningNode(string cryptoCode, LightningConnectionType? connectionType = null, bool isMerchant = true) { RegisterLightningNodeAsync(cryptoCode, connectionType, isMerchant).GetAwaiter().GetResult(); } diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index e390b37f1..3b776c660 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -466,14 +466,6 @@ namespace BTCPayServer.Tests await ProcessLightningPayment(LightningConnectionType.CLightning); } - [Fact(Timeout = 60 * 2 * 1000)] - [Trait("Integration", "Integration")] - [Trait("Lightning", "Lightning")] - public async Task CanSendLightningPaymentCharge() - { - await ProcessLightningPayment(LightningConnectionType.Charge); - } - [Fact(Timeout = 60 * 2 * 1000)] [Trait("Integration", "Integration")] [Trait("Lightning", "Lightning")] @@ -1634,7 +1626,7 @@ namespace BTCPayServer.Tests var user = tester.NewAccount(); var cryptoCode = "BTC"; user.GrantAccess(true); - user.RegisterLightningNode(cryptoCode, LightningConnectionType.Charge); + user.RegisterLightningNode(cryptoCode); user.SetLNUrl(cryptoCode, false); var vm = user.GetController().CheckoutAppearance().AssertViewModel(); var criteria = Assert.Single(vm.PaymentMethodCriteria); @@ -1654,7 +1646,7 @@ namespace BTCPayServer.Tests Assert.Equal(PaymentTypes.LightningLike.ToString(), invoice.CryptoInfo[0].PaymentType); // Activating LNUrl, we should still have only 1 payment criteria that can be set. - user.RegisterLightningNode(cryptoCode, LightningConnectionType.Charge); + user.RegisterLightningNode(cryptoCode); user.SetLNUrl(cryptoCode, true); vm = user.GetController().CheckoutAppearance().AssertViewModel(); criteria = Assert.Single(vm.PaymentMethodCriteria); diff --git a/BTCPayServer.Tests/docker-compose.altcoins.yml b/BTCPayServer.Tests/docker-compose.altcoins.yml index 62b2eb4d4..428344332 100644 --- a/BTCPayServer.Tests/docker-compose.altcoins.yml +++ b/BTCPayServer.Tests/docker-compose.altcoins.yml @@ -24,7 +24,6 @@ services: TESTS_AzureBlobStorageConnectionString: ${TESTS_AzureBlobStorageConnectionString:-none} TEST_MERCHANTLIGHTNINGD: "type=clightning;server=unix://etc/merchant_lightningd_datadir/lightning-rpc" TEST_CUSTOMERLIGHTNINGD: "type=clightning;server=unix://etc/customer_lightningd_datadir/lightning-rpc" - TEST_MERCHANTCHARGE: "type=charge;server=http://lightning-charged:9112/;api-token=foiewnccewuify;allowinsecure=true" TEST_MERCHANTLND: "http://lnd:lnd@merchant_lnd:8080/" TESTS_INCONTAINER: "true" TESTS_SSHCONNECTION: "root@sshd:22" @@ -56,7 +55,6 @@ services: - postgres - customer_lightningd - merchant_lightningd - - lightning-charged - customer_lnd - merchant_lnd - sshd @@ -89,12 +87,17 @@ services: - postgres - customer_lnd - merchant_lnd + selenium: image: selenium/standalone-chrome:101.0 + extra_hosts: + - "tests:172.23.0.18" expose: - "4444" - extra_hosts: - - "tests:172.18.0.18" + networks: + default: + custom: + nbxplorer: image: nicolasdorier/nbxplorer:2.3.63 restart: unless-stopped @@ -160,7 +163,7 @@ services: - "bitcoin_datadir:/data" customer_lightningd: - image: btcpayserver/lightning:v23.02-1-dev + image: btcpayserver/lightning:v23.05-dev stop_signal: SIGKILL restart: unless-stopped environment: @@ -186,30 +189,8 @@ services: depends_on: - bitcoind - lightning-charged: - image: shesek/lightning-charge:0.4.23-1-standalone - restart: unless-stopped - environment: - NETWORK: regtest - API_TOKEN: foiewnccewuify - BITCOIND_RPCCONNECT: bitcoind - LN_NET_PATH: /etc/lightning - LN_NET: /etc/lightning - volumes: - - "bitcoin_datadir:/etc/bitcoin" - - "lightning_charge_datadir:/data" - - "merchant_lightningd_datadir:/etc/lightning" - expose: - - "9112" # Charge - - "9735" # Lightning - ports: - - "54938:9112" # Charge - depends_on: - - bitcoind - - merchant_lightningd - merchant_lightningd: - image: btcpayserver/lightning:v23.02-1-dev + image: btcpayserver/lightning:v23.05-dev stop_signal: SIGKILL environment: EXPOSE_TCP: "true" diff --git a/BTCPayServer.Tests/docker-compose.yml b/BTCPayServer.Tests/docker-compose.yml index e5950ca77..c39460725 100644 --- a/BTCPayServer.Tests/docker-compose.yml +++ b/BTCPayServer.Tests/docker-compose.yml @@ -22,7 +22,6 @@ services: TESTS_AzureBlobStorageConnectionString: ${TESTS_AzureBlobStorageConnectionString:-none} TEST_MERCHANTLIGHTNINGD: "type=clightning;server=unix://etc/merchant_lightningd_datadir/lightning-rpc" TEST_CUSTOMERLIGHTNINGD: "type=clightning;server=unix://etc/customer_lightningd_datadir/lightning-rpc" - TEST_MERCHANTCHARGE: "type=charge;server=http://lightning-charged:9112/;api-token=foiewnccewuify;allowinsecure=true" TEST_MERCHANTLND: "http://lnd:lnd@merchant_lnd:8080/" TESTS_INCONTAINER: "true" TESTS_SSHCONNECTION: "root@sshd:22" @@ -54,7 +53,6 @@ services: - postgres - customer_lightningd - merchant_lightningd - - lightning-charged - customer_lnd - merchant_lnd - sshd @@ -79,19 +77,24 @@ services: BITCOIN_EXTRA_ARGS: | deprecatedrpc=signrawtransaction connect=bitcoind:39388 - rpcallowip=0.0.0.0/0 fallbackfee=0.0002 + rpcallowip=0.0.0.0/0 depends_on: - nbxplorer - postgres - customer_lnd - merchant_lnd + selenium: image: selenium/standalone-chrome:101.0 extra_hosts: - - "tests:172.18.0.18" + - "tests:172.23.0.18" expose: - "4444" + networks: + default: + custom: + nbxplorer: image: nicolasdorier/nbxplorer:2.3.63 restart: unless-stopped @@ -146,7 +149,7 @@ services: - "bitcoin_datadir:/data" customer_lightningd: - image: btcpayserver/lightning:v23.02-1-dev + image: btcpayserver/lightning:v23.05-dev stop_signal: SIGKILL restart: unless-stopped environment: @@ -172,30 +175,8 @@ services: depends_on: - bitcoind - lightning-charged: - image: shesek/lightning-charge:0.4.23-1-standalone - restart: unless-stopped - environment: - NETWORK: regtest - API_TOKEN: foiewnccewuify - BITCOIND_RPCCONNECT: bitcoind - LN_NET_PATH: /etc/lightning - LN_NET: /etc/lightning - volumes: - - "bitcoin_datadir:/etc/bitcoin" - - "lightning_charge_datadir:/data" - - "merchant_lightningd_datadir:/etc/lightning" - expose: - - "9112" # Charge - - "9735" # Lightning - ports: - - "54938:9112" # Charge - depends_on: - - bitcoind - - merchant_lightningd - merchant_lightningd: - image: btcpayserver/lightning:v23.02-1-dev + image: btcpayserver/lightning:v23.05-dev stop_signal: SIGKILL environment: EXPOSE_TCP: "true" diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index 0497e4f99..653aaa447 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -47,7 +47,7 @@ - +