2

I've been having some problem connecting to an LND node running on Polar. I keep constantly getting this error:

tonic::transport::Error(Transport, hyper::Error(Connect, Custom { kind: InvalidData, error: InvalidCertificate(Other(CaUsedAsEndEntity)) }))'

this code that I'm using for that:

#[tokio::main]
async fn main() {
    // build our application with a single route
    let app = Router::new().route("/", get(|| async { "Hello, World!" }));

    let cert = Certificate::from_pem(include_bytes!("<route-to>/lnd/alice/tls.cert"));

    let tls_conf: ClientTlsConfig = ClientTlsConfig::new().domain_name("localhost").ca_certificate(cert);

    let channel =  tonic::transport::Channel::from_static("https://127.0.0.1:10001").tls_config(tls_conf).unwrap().connect().await.unwrap();

    // run it with hyper on localhost:3000
    axum::Server::bind(&"0.0.0.0:3000".parse().unwrap())
        .serve(app.into_make_service())
        .await.unwrap();
}

please advice. This is getting crazy hahaha, I actually checked out the code from lncli but got confused on what is being done with TLS

lescuer
  • 63
  • 1
  • 4

0 Answers0