test-connection just exists to help you find the proper parameters to connect to your LND server.
It’s worth remembering that all lntoolkit commands take the same parameters for connecting to your LND instance, so getting the right parameters for this command means you have the right parameters for all the commands.
Here’s a simple example of running the command:
If it can connect, it will show something like the following output:
2019/04/01 18:31:21 📄 Connection successful! LND pubkey is: 02639adf914ec9dfd8649c47de1d232de4a23b0719b1d8bd2bef9beb32f948018e, synced to chain is: true 2019/04/01 18:31:21 📄 No tip to send. That's OK, I still love you! 🥰
If it fails, it will try to give the reason for the failure. For example:
2019/04/01 18:41:04 🚨 Exiting with error: accessing certificate file at '~/.lnd/tls.cert': could not find certificate file at '/Users/geoff/.lnd/tls.cert'
This means it can’t find the tls.cert file in the expected place. This is one of the earliest stages where it can fail, so make sure you have mapped your .lnd directory properly.
It can be worth experimenting with the full docker command line for the test-connection command:
docker run --rm --network=host -v=$HOME/.lnd:/root/.lnd lntoolkit:latest test-connection
Another common failure is:
2019/04/01 18:38:53 🚨 Exiting with error: creating Lightning client: context deadline exceeded
This happens if for some reason it cannot connect to your server on the network.
Here’s the list of parameters it can take:
Usage of test-connection: -certificate string path and filename of the TLS certificate to use when connecting to LND. (default "~/.lnd/tls.cert") -macaroon string path and filename of the macaroon to use when connecting to LND. (default "~/.lnd/data/chain/bitcoin/testnet/admin.macaroon") -quiet only show errors and critical messages. -server string hostname and port to use when connecting to LND. (default "localhost:10009") -timeout duration timeout to use when connecting to LND. (default 30s) -tip value tip amount (in satoshis) to the developer as a thank-you (Tip is only paid if an action is performed.) -verbose show additional logging information. -version report the version being used.
Like all LN Toolkit commands, is-synced can take a --verbose flag to greatly increase the amount of diagnostic output it creates (including JSON representations of routes, if you like that kind of thing). It can also take a --tip <amount> parameter if you want to tip me some satoshis.