Providing ability to increase lightning timeout for tests/debugging

This commit is contained in:
rockstardev 2018-05-31 16:31:39 -05:00
parent 0d1d0d57f4
commit f8c88bd44f
2 changed files with 7 additions and 2 deletions

View file

@ -493,6 +493,9 @@ namespace BTCPayServer.Tests
[Fact]
public void CanSendLightningPaymentLnd()
{
// For easier debugging and testing
LightningLikePaymentHandler.LIGHTNING_TIMEOUT = int.MaxValue;
ProcessLightningPayment(LightningConnectionType.Lnd);
}

View file

@ -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;