mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-02 21:04:25 +01:00
Do not block payments on LN while syncing if it is not internal node (#5269)
This commit is contained in:
@@ -121,9 +121,9 @@ namespace BTCPayServer.Payments.Lightning
|
||||
|
||||
public async Task<NodeInfo[]> GetNodeInfo(LightningSupportedPaymentMethod supportedPaymentMethod, BTCPayNetwork network, InvoiceLogs invoiceLogs, bool? preferOnion = null, bool throws = false)
|
||||
{
|
||||
if (!_Dashboard.IsFullySynched(network.CryptoCode, out var summary))
|
||||
throw new PaymentMethodUnavailableException("Full node not available");
|
||||
|
||||
var synced = _Dashboard.IsFullySynched(network.CryptoCode, out var summary);
|
||||
if (supportedPaymentMethod.IsInternalNode && !synced)
|
||||
throw new PaymentMethodUnavailableException("Full node not available");;
|
||||
try
|
||||
{
|
||||
using var cts = new CancellationTokenSource(LightningTimeout);
|
||||
@@ -156,13 +156,13 @@ namespace BTCPayServer.Payments.Lightning
|
||||
var nodeInfo = preferOnion != null && info.NodeInfoList.Any(i => i.IsTor == preferOnion)
|
||||
? info.NodeInfoList.Where(i => i.IsTor == preferOnion.Value).ToArray()
|
||||
: info.NodeInfoList.Select(i => i).ToArray();
|
||||
|
||||
|
||||
var blocksGap = summary.Status.ChainHeight - info.BlockHeight;
|
||||
if (blocksGap > 10 && !(isLndHub && info.BlockHeight == 0))
|
||||
{
|
||||
throw new PaymentMethodUnavailableException($"The lightning node is not synched ({blocksGap} blocks left)");
|
||||
throw new PaymentMethodUnavailableException(
|
||||
$"The lightning node is not synched ({blocksGap} blocks left)");
|
||||
}
|
||||
|
||||
return nodeInfo;
|
||||
}
|
||||
catch (Exception e) when (!throws)
|
||||
|
||||
Reference in New Issue
Block a user