Kixunil / tonic_lnd

Rust implementation of LND RPC client using async GRPC library `tonic`
31 stars 44 forks source link

Fail to get example working #16

Closed yzernik closed 2 years ago

yzernik commented 2 years ago

I just tried running the "getinfo" example on a new Polar LND instance:

$ cargo run --example getinfo 127.0.0.1:10002 /home/yzernik/.polar/networks/1/volumes/lnd/bob/tls.cert /home/yzernik/.polar/networks/1/volumes/lnd/bob/data/chain/bitcoin/regtest/admin.macaroon
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/examples/getinfo '127.0.0.1:10002' /home/yzernik/.polar/networks/1/volumes/lnd/bob/tls.cert /home/yzernik/.polar/networks/1/volumes/lnd/bob/data/chain/bitcoin/regtest/admin.macaroon`
thread 'main' panicked at 'failed to connect: ConnectError { internal: Connect { address: "127.0.0.1:10002", error: tonic::transport::Error(Transport, hyper::Error(Connect, "invalid URL, scheme is missing")) } }', examples/getinfo.rs:16:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I know that the LND instance is configured correctly because I can connect and "getinfo" with the Python client:

$ python example.py 
identity_pubkey: "03821db610fc9af2d60b4c356fbb8b7c44a5ba898050be2617543231f965001cbb"
...
yzernik commented 2 years ago

Ok, got it working now. I had to put the full URL with the "http://" prefix.

$ cargo run --example getinfo http://localhost:10002 /home/yzernik/.polar/networks/1/volumes/lnd/bob/tls.cert /home/yzernik/.polar/networks/1/volumes/lnd/bob/data/chain/bitcoin/regtest/admin.macaroon
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
     Running `target/debug/examples/getinfo 'http://localhost:10002' /home/yzernik/.polar/networks/1/volumes/lnd/bob/tls.cert /home/yzernik/.polar/networks/1/volumes/lnd/bob/data/chain/bitcoin/regtest/admin.macaroon`
Response {
    metadata: MetadataMap {
        headers: {
            "content-type": "application/grpc",
            "grpc-status": "0",
            "grpc-message": "",
        },
    },
    message: GetInfoResponse {
        version: "0.15.0-beta commit=v0.15.0-beta",
...