diff --git a/BTCPayServer/Payments/Lightning/Lnd/LndSwaggerClientCustomHttp.cs b/BTCPayServer/Payments/Lightning/Lnd/LndSwaggerClientCustomHttp.cs index 7f9c92eb5..8f8187615 100644 --- a/BTCPayServer/Payments/Lightning/Lnd/LndSwaggerClientCustomHttp.cs +++ b/BTCPayServer/Payments/Lightning/Lnd/LndSwaggerClientCustomHttp.cs @@ -51,14 +51,20 @@ namespace BTCPayServer.Payments.Lightning.Lnd private static HttpClientHandler GetCertificate(byte[] certFile) { - X509Certificate2 clientCertificate = null; - if (certFile != null) - clientCertificate = new X509Certificate2(certFile); - var handler = new HttpClientHandler { SslProtocols = SslProtocols.Tls12 }; + if (certFile == null) + { + handler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator; + return handler; + } + + // if certificate is not null, try with custom accepting logic + X509Certificate2 clientCertificate = null; + if (certFile != null) + clientCertificate = new X509Certificate2(certFile); handler.ServerCertificateCustomValidationCallback = (request, cert, chain, errors) => {