Reuse LightningTimeout constant

This commit is contained in:
Dennis Reimann
2023-03-21 14:22:10 +01:00
parent 55565f1718
commit ad5752f09b
2 changed files with 4 additions and 4 deletions

View File

@@ -67,7 +67,7 @@ namespace BTCPayServer.Payments.Lightning
{
throw new PaymentMethodUnavailableException("LNURL requires a lightning node to be configured for the store.");
}
using var cts = new CancellationTokenSource(5000);
using var cts = new CancellationTokenSource(LightningLikePaymentHandler.LightningTimeout);
try
{
var client = lnSupported.CreateLightningClient(network, Options.Value, _lightningClientFactoryService);

View File

@@ -21,7 +21,7 @@ namespace BTCPayServer.Payments.Lightning
{
public class LightningLikePaymentHandler : PaymentMethodHandlerBase<LightningSupportedPaymentMethod, BTCPayNetwork>
{
public static int LIGHTNING_TIMEOUT = 5000;
public static readonly int LightningTimeout = 5000;
readonly NBXplorerDashboard _Dashboard;
private readonly LightningClientFactoryService _lightningClientFactory;
private readonly BTCPayNetworkProvider _networkProvider;
@@ -93,7 +93,7 @@ namespace BTCPayServer.Payments.Lightning
description = description.Replace("{StoreName}", store.StoreName ?? "", StringComparison.OrdinalIgnoreCase)
.Replace("{ItemDescription}", invoice.Metadata.ItemDesc ?? "", StringComparison.OrdinalIgnoreCase)
.Replace("{OrderId}", invoice.Metadata.OrderId ?? "", StringComparison.OrdinalIgnoreCase);
using (var cts = new CancellationTokenSource(LIGHTNING_TIMEOUT))
using (var cts = new CancellationTokenSource(LightningTimeout))
{
try
{
@@ -129,7 +129,7 @@ namespace BTCPayServer.Payments.Lightning
try
{
using var cts = new CancellationTokenSource(LIGHTNING_TIMEOUT);
using var cts = new CancellationTokenSource(LightningTimeout);
var client = CreateLightningClient(supportedPaymentMethod, network);
LightningNodeInformation info;
try