mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-20 13:34:37 +01:00
Providing ability to increase lightning timeout for tests/debugging
This commit is contained in:
parent
0d1d0d57f4
commit
f8c88bd44f
2 changed files with 7 additions and 2 deletions
|
@ -493,6 +493,9 @@ namespace BTCPayServer.Tests
|
|||
[Fact]
|
||||
public void CanSendLightningPaymentLnd()
|
||||
{
|
||||
// For easier debugging and testing
|
||||
LightningLikePaymentHandler.LIGHTNING_TIMEOUT = int.MaxValue;
|
||||
|
||||
ProcessLightningPayment(LightningConnectionType.Lnd);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace BTCPayServer.Payments.Lightning
|
|||
{
|
||||
public class LightningLikePaymentHandler : PaymentMethodHandlerBase<LightningSupportedPaymentMethod>
|
||||
{
|
||||
public static int LIGHTNING_TIMEOUT = 5000;
|
||||
|
||||
NBXplorerDashboard _Dashboard;
|
||||
LightningClientFactory _LightningClientFactory;
|
||||
public LightningLikePaymentHandler(
|
||||
|
@ -41,7 +43,7 @@ namespace BTCPayServer.Payments.Lightning
|
|||
description = description.Replace("{StoreName}", store.StoreName ?? "", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("{ItemDescription}", invoice.ProductInformation.ItemDesc ?? "", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("{OrderId}", invoice.OrderId ?? "", StringComparison.OrdinalIgnoreCase);
|
||||
using (var cts = new CancellationTokenSource(5000))
|
||||
using (var cts = new CancellationTokenSource(LIGHTNING_TIMEOUT))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -70,7 +72,7 @@ namespace BTCPayServer.Payments.Lightning
|
|||
if (!_Dashboard.IsFullySynched(network.CryptoCode, out var summary))
|
||||
throw new PaymentMethodUnavailableException($"Full node not available");
|
||||
|
||||
using (var cts = new CancellationTokenSource(5000))
|
||||
using (var cts = new CancellationTokenSource(LIGHTNING_TIMEOUT))
|
||||
{
|
||||
var client = _LightningClientFactory.CreateClient(supportedPaymentMethod, network);
|
||||
LightningNodeInformation info = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue