bump clightning (#4970)

* bump clightning

* Remove Lightning Charge from our tests
This commit is contained in:
Nicolas Dorier 2023-05-16 09:17:21 +09:00 committed by GitHub
parent 8db5e7e043
commit 7b96f96025
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 33 additions and 105 deletions

View File

@ -245,7 +245,7 @@ namespace BTCPayServer.Tests
await tester.EnsureChannelsSetup(); await tester.EnsureChannelsSetup();
var user = tester.NewAccount(); var user = tester.NewAccount();
user.GrantAccess(true); user.GrantAccess(true);
user.RegisterLightningNode("BTC", LightningConnectionType.Charge); user.RegisterLightningNode("BTC");
user.RegisterDerivationScheme("BTC"); user.RegisterDerivationScheme("BTC");
user.RegisterDerivationScheme("LTC"); user.RegisterDerivationScheme("LTC");

View File

@ -2442,27 +2442,10 @@ namespace BTCPayServer.Tests
Assert.NotNull(merchantInvoice.PaymentHash); Assert.NotNull(merchantInvoice.PaymentHash);
Assert.Equal(merchantInvoice.Id, merchantInvoice.PaymentHash); Assert.Equal(merchantInvoice.Id, merchantInvoice.PaymentHash);
// The default client is using charge, so we should not be able to query channels var client = await user.CreateClient(Policies.CanUseInternalLightningNode);
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"));
// Not permission for the store! // Not permission for the store!
await AssertAPIError("missing-permission", () => chargeClient.GetLightningNodeChannels(user.StoreId, "BTC")); await AssertAPIError("missing-permission", () => client.GetLightningNodeChannels(user.StoreId, "BTC"));
var invoiceData = await chargeClient.CreateLightningInvoice("BTC", new CreateLightningInvoiceRequest() var invoiceData = await client.CreateLightningInvoice("BTC", new CreateLightningInvoiceRequest()
{ {
Amount = LightMoney.Satoshis(1000), Amount = LightMoney.Satoshis(1000),
Description = "lol", Description = "lol",
@ -2470,17 +2453,17 @@ namespace BTCPayServer.Tests
PrivateRouteHints = false PrivateRouteHints = false
}); });
var chargeInvoice = invoiceData; var chargeInvoice = invoiceData;
Assert.NotNull(await chargeClient.GetLightningInvoice("BTC", invoiceData.Id)); Assert.NotNull(await client.GetLightningInvoice("BTC", invoiceData.Id));
// check list for internal node // check list for internal node
var invoices = await chargeClient.GetLightningInvoices("BTC"); var invoices = await client.GetLightningInvoices("BTC");
var pendingInvoices = await chargeClient.GetLightningInvoices("BTC", true); var pendingInvoices = await client.GetLightningInvoices("BTC", true);
Assert.NotEmpty(invoices); Assert.NotEmpty(invoices);
Assert.Contains(invoices, i => i.Id == invoiceData.Id); Assert.Contains(invoices, i => i.Id == invoiceData.Id);
Assert.NotEmpty(pendingInvoices); Assert.NotEmpty(pendingInvoices);
Assert.Contains(pendingInvoices, i => i.Id == invoiceData.Id); 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 // Not permission for the server
await AssertAPIError("missing-permission", () => client.GetLightningNodeChannels("BTC")); await AssertAPIError("missing-permission", () => client.GetLightningNodeChannels("BTC"));
@ -2559,7 +2542,7 @@ namespace BTCPayServer.Tests
Assert.Contains(payments, i => i.BOLT11 == merchantInvoice.BOLT11); Assert.Contains(payments, i => i.BOLT11 == merchantInvoice.BOLT11);
// Node info // Node info
info = await client.GetLightningNodeInfo(user.StoreId, "BTC"); var info = await client.GetLightningNodeInfo(user.StoreId, "BTC");
Assert.Single(info.NodeURIs); Assert.Single(info.NodeURIs);
Assert.NotEqual(0, info.BlockHeight); Assert.NotEqual(0, info.BlockHeight);

View File

@ -313,8 +313,6 @@ namespace BTCPayServer.Tests
var connectionString = connectionType switch var connectionString = connectionType switch
{ {
LightningConnectionType.Charge =>
$"type=charge;server={Server.MerchantCharge.Client.Uri.AbsoluteUri};allowinsecure=true",
LightningConnectionType.CLightning => LightningConnectionType.CLightning =>
$"type=clightning;server={((CLightningClient)Server.MerchantLightningD).Address.AbsoluteUri}", $"type=clightning;server={((CLightningClient)Server.MerchantLightningD).Address.AbsoluteUri}",
LightningConnectionType.LndREST => LightningConnectionType.LndREST =>

View File

@ -92,7 +92,7 @@ namespace BTCPayServer.Tests
#endif #endif
public void ActivateLightning() public void ActivateLightning()
{ {
ActivateLightning(LightningConnectionType.Charge); ActivateLightning(LightningConnectionType.CLightning);
} }
public void ActivateLightning(LightningConnectionType internalNode) public void ActivateLightning(LightningConnectionType internalNode)
{ {
@ -109,14 +109,7 @@ namespace BTCPayServer.Tests
string connectionString = null; string connectionString = null;
if (connectionType is null) if (connectionType is null)
return LightningSupportedPaymentMethod.InternalNode; return LightningSupportedPaymentMethod.InternalNode;
if (connectionType == LightningConnectionType.Charge) if (connectionType == LightningConnectionType.CLightning)
{
if (isMerchant)
connectionString = $"type=charge;server={MerchantCharge.Client.Uri.AbsoluteUri};allowinsecure=true";
else
throw new NotSupportedException();
}
else if (connectionType == LightningConnectionType.CLightning)
{ {
if (isMerchant) if (isMerchant)
connectionString = "type=clightning;server=" + connectionString = "type=clightning;server=" +

View File

@ -277,7 +277,7 @@ namespace BTCPayServer.Tests
public bool IsAdmin { get; internal set; } 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(); RegisterLightningNodeAsync(cryptoCode, connectionType, isMerchant).GetAwaiter().GetResult();
} }

View File

@ -466,14 +466,6 @@ namespace BTCPayServer.Tests
await ProcessLightningPayment(LightningConnectionType.CLightning); 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)] [Fact(Timeout = 60 * 2 * 1000)]
[Trait("Integration", "Integration")] [Trait("Integration", "Integration")]
[Trait("Lightning", "Lightning")] [Trait("Lightning", "Lightning")]
@ -1634,7 +1626,7 @@ namespace BTCPayServer.Tests
var user = tester.NewAccount(); var user = tester.NewAccount();
var cryptoCode = "BTC"; var cryptoCode = "BTC";
user.GrantAccess(true); user.GrantAccess(true);
user.RegisterLightningNode(cryptoCode, LightningConnectionType.Charge); user.RegisterLightningNode(cryptoCode);
user.SetLNUrl(cryptoCode, false); user.SetLNUrl(cryptoCode, false);
var vm = user.GetController<UIStoresController>().CheckoutAppearance().AssertViewModel<CheckoutAppearanceViewModel>(); var vm = user.GetController<UIStoresController>().CheckoutAppearance().AssertViewModel<CheckoutAppearanceViewModel>();
var criteria = Assert.Single(vm.PaymentMethodCriteria); var criteria = Assert.Single(vm.PaymentMethodCriteria);
@ -1654,7 +1646,7 @@ namespace BTCPayServer.Tests
Assert.Equal(PaymentTypes.LightningLike.ToString(), invoice.CryptoInfo[0].PaymentType); Assert.Equal(PaymentTypes.LightningLike.ToString(), invoice.CryptoInfo[0].PaymentType);
// Activating LNUrl, we should still have only 1 payment criteria that can be set. // 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); user.SetLNUrl(cryptoCode, true);
vm = user.GetController<UIStoresController>().CheckoutAppearance().AssertViewModel<CheckoutAppearanceViewModel>(); vm = user.GetController<UIStoresController>().CheckoutAppearance().AssertViewModel<CheckoutAppearanceViewModel>();
criteria = Assert.Single(vm.PaymentMethodCriteria); criteria = Assert.Single(vm.PaymentMethodCriteria);

View File

@ -24,7 +24,6 @@ services:
TESTS_AzureBlobStorageConnectionString: ${TESTS_AzureBlobStorageConnectionString:-none} TESTS_AzureBlobStorageConnectionString: ${TESTS_AzureBlobStorageConnectionString:-none}
TEST_MERCHANTLIGHTNINGD: "type=clightning;server=unix://etc/merchant_lightningd_datadir/lightning-rpc" 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_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/" TEST_MERCHANTLND: "http://lnd:lnd@merchant_lnd:8080/"
TESTS_INCONTAINER: "true" TESTS_INCONTAINER: "true"
TESTS_SSHCONNECTION: "root@sshd:22" TESTS_SSHCONNECTION: "root@sshd:22"
@ -56,7 +55,6 @@ services:
- postgres - postgres
- customer_lightningd - customer_lightningd
- merchant_lightningd - merchant_lightningd
- lightning-charged
- customer_lnd - customer_lnd
- merchant_lnd - merchant_lnd
- sshd - sshd
@ -89,12 +87,17 @@ services:
- postgres - postgres
- customer_lnd - customer_lnd
- merchant_lnd - merchant_lnd
selenium: selenium:
image: selenium/standalone-chrome:101.0 image: selenium/standalone-chrome:101.0
extra_hosts:
- "tests:172.23.0.18"
expose: expose:
- "4444" - "4444"
extra_hosts: networks:
- "tests:172.18.0.18" default:
custom:
nbxplorer: nbxplorer:
image: nicolasdorier/nbxplorer:2.3.63 image: nicolasdorier/nbxplorer:2.3.63
restart: unless-stopped restart: unless-stopped
@ -160,7 +163,7 @@ services:
- "bitcoin_datadir:/data" - "bitcoin_datadir:/data"
customer_lightningd: customer_lightningd:
image: btcpayserver/lightning:v23.02-1-dev image: btcpayserver/lightning:v23.05-dev
stop_signal: SIGKILL stop_signal: SIGKILL
restart: unless-stopped restart: unless-stopped
environment: environment:
@ -186,30 +189,8 @@ services:
depends_on: depends_on:
- bitcoind - 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: merchant_lightningd:
image: btcpayserver/lightning:v23.02-1-dev image: btcpayserver/lightning:v23.05-dev
stop_signal: SIGKILL stop_signal: SIGKILL
environment: environment:
EXPOSE_TCP: "true" EXPOSE_TCP: "true"

View File

@ -22,7 +22,6 @@ services:
TESTS_AzureBlobStorageConnectionString: ${TESTS_AzureBlobStorageConnectionString:-none} TESTS_AzureBlobStorageConnectionString: ${TESTS_AzureBlobStorageConnectionString:-none}
TEST_MERCHANTLIGHTNINGD: "type=clightning;server=unix://etc/merchant_lightningd_datadir/lightning-rpc" 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_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/" TEST_MERCHANTLND: "http://lnd:lnd@merchant_lnd:8080/"
TESTS_INCONTAINER: "true" TESTS_INCONTAINER: "true"
TESTS_SSHCONNECTION: "root@sshd:22" TESTS_SSHCONNECTION: "root@sshd:22"
@ -54,7 +53,6 @@ services:
- postgres - postgres
- customer_lightningd - customer_lightningd
- merchant_lightningd - merchant_lightningd
- lightning-charged
- customer_lnd - customer_lnd
- merchant_lnd - merchant_lnd
- sshd - sshd
@ -79,19 +77,24 @@ services:
BITCOIN_EXTRA_ARGS: | BITCOIN_EXTRA_ARGS: |
deprecatedrpc=signrawtransaction deprecatedrpc=signrawtransaction
connect=bitcoind:39388 connect=bitcoind:39388
rpcallowip=0.0.0.0/0
fallbackfee=0.0002 fallbackfee=0.0002
rpcallowip=0.0.0.0/0
depends_on: depends_on:
- nbxplorer - nbxplorer
- postgres - postgres
- customer_lnd - customer_lnd
- merchant_lnd - merchant_lnd
selenium: selenium:
image: selenium/standalone-chrome:101.0 image: selenium/standalone-chrome:101.0
extra_hosts: extra_hosts:
- "tests:172.18.0.18" - "tests:172.23.0.18"
expose: expose:
- "4444" - "4444"
networks:
default:
custom:
nbxplorer: nbxplorer:
image: nicolasdorier/nbxplorer:2.3.63 image: nicolasdorier/nbxplorer:2.3.63
restart: unless-stopped restart: unless-stopped
@ -146,7 +149,7 @@ services:
- "bitcoin_datadir:/data" - "bitcoin_datadir:/data"
customer_lightningd: customer_lightningd:
image: btcpayserver/lightning:v23.02-1-dev image: btcpayserver/lightning:v23.05-dev
stop_signal: SIGKILL stop_signal: SIGKILL
restart: unless-stopped restart: unless-stopped
environment: environment:
@ -172,30 +175,8 @@ services:
depends_on: depends_on:
- bitcoind - 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: merchant_lightningd:
image: btcpayserver/lightning:v23.02-1-dev image: btcpayserver/lightning:v23.05-dev
stop_signal: SIGKILL stop_signal: SIGKILL
environment: environment:
EXPOSE_TCP: "true" EXPOSE_TCP: "true"

View File

@ -47,7 +47,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="BIP78.Sender" Version="0.2.2" /> <PackageReference Include="BIP78.Sender" Version="0.2.2" />
<PackageReference Include="BTCPayServer.Hwi" Version="2.0.2" /> <PackageReference Include="BTCPayServer.Hwi" Version="2.0.2" />
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.4.23" /> <PackageReference Include="BTCPayServer.Lightning.All" Version="1.4.24" />
<PackageReference Include="CsvHelper" Version="15.0.5" /> <PackageReference Include="CsvHelper" Version="15.0.5" />
<PackageReference Include="Dapper" Version="2.0.123" /> <PackageReference Include="Dapper" Version="2.0.123" />
<PackageReference Include="Fido2" Version="2.0.2" /> <PackageReference Include="Fido2" Version="2.0.2" />