diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index 5eca11a60..13572d28a 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -2,7 +2,7 @@ Exe netcoreapp2.1 - 1.0.2.78 + 1.0.2.79 NU1701,CA1816,CA1308,CA1810,CA2208 diff --git a/BTCPayServer/Payments/Lightning/Lnd/LndInvoiceClient.cs b/BTCPayServer/Payments/Lightning/Lnd/LndInvoiceClient.cs index 61d3a9c60..e174c3b33 100644 --- a/BTCPayServer/Payments/Lightning/Lnd/LndInvoiceClient.cs +++ b/BTCPayServer/Payments/Lightning/Lnd/LndInvoiceClient.cs @@ -183,18 +183,24 @@ namespace BTCPayServer.Payments.Lightning.Lnd NodeId = resp.Identity_pubkey }; + try + { + var node = await _rpcClient.GetNodeInfoAsync(resp.Identity_pubkey, cancellation); + if (node.Node.Addresses == null || node.Node.Addresses.Count == 0) + throw new Exception("Lnd External IP not set, make sure you use --externalip=$EXTERNALIP parameter on lnd"); - var node = await _rpcClient.GetNodeInfoAsync(resp.Identity_pubkey, cancellation); - if (node.Node.Addresses == null || node.Node.Addresses.Count == 0) - throw new Exception("Lnd External IP not set, make sure you use --externalip=$EXTERNALIP parameter on lnd"); + var firstNodeInfo = node.Node.Addresses.First(); + var externalHostPort = firstNodeInfo.Addr.Split(':'); - var firstNodeInfo = node.Node.Addresses.First(); - var externalHostPort = firstNodeInfo.Addr.Split(':'); + nodeInfo.Address = externalHostPort[0]; + nodeInfo.P2PPort = ConvertInv.ToInt32(externalHostPort[1]); - nodeInfo.Address = externalHostPort[0]; - nodeInfo.P2PPort = ConvertInv.ToInt32(externalHostPort[1]); - - return nodeInfo; + return nodeInfo; + } + catch (SwaggerException ex) when (!string.IsNullOrEmpty(ex.Response)) + { + throw new Exception("LND threw an error: " + ex.Response); + } } public async Task GetInvoice(string invoiceId, CancellationToken cancellation = default(CancellationToken))