Skip to content

Commit

Permalink
Lightning: Relax GetInfo constraint for LNDhub connections
Browse files Browse the repository at this point in the history
The LNDhub-compatible implementation by LNbits does not support the `GetInfo` call for all their funding sources — see lnbits/lnbits#1182. By catching that exception in combination with the `LndHubLightningClient`, we give people the ability to still use their LNbits-based LNDhub as a Lightning node.

Fixes btcpayserver#4482.
  • Loading branch information
dennisreimann committed Jun 17, 2023
1 parent cc3bdc3 commit 168e24d
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using BTCPayServer.Data;
using BTCPayServer.HostedServices;
using BTCPayServer.Lightning;
using BTCPayServer.Lightning.LndHub;
using BTCPayServer.Logging;
using BTCPayServer.Models;
using BTCPayServer.Models.InvoicingModels;
Expand Down Expand Up @@ -136,6 +137,10 @@ public async Task<NodeInfo[]> GetNodeInfo(LightningSupportedPaymentMethod suppor
{
throw new PaymentMethodUnavailableException("The lightning node did not reply in a timely manner");
}
catch (NullReferenceException) when (client is LndHubLightningClient)
{ // LNDhub-compatible implementation by LNbits does not support GetInfo, see https://github.com/lnbits/lnbits/issues/1182
return new NodeInfo[] {};
}
catch (Exception ex)
{
throw new PaymentMethodUnavailableException($"Error while connecting to the API: {ex.Message}" +
Expand Down

0 comments on commit 168e24d

Please sign in to comment.