is-synced outputs true if LND is synced to its chain, and false otherwise.
This is handy for checking in scripts whether LND is synced. It’s equivalent to checking lncli getinfo but the script doesn’t need to parse any JSON.
This is equivalent to running lncli getinfo and looking at the synced_to_chain property.
Here’s a simple example of running the command:
lntoolkit is-synced --quiet
This will output the word true or the word false.
Sometimes LND temporarily becomes un-synced, but it corrects itself after a few seconds. Here’s an example of running the command with retries:
lntoolkit is-synced --retries 5 --time-between-retries 1m --quiet
Again, this will output the word true or the word false. If LND is not synced the first time it tries, it will wait for 1 minute (from --time-between-retries 1m) and try again. It will retry up to 5 times (from --retries 5), meaning it will make at most 6 attempts (1 initial attempt plus 5 retries).
Here’s the list of parameters it can take:
Usage of is-synced: -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. -retries int number of times to retry if LND reports synced-to-chain is false. (default 2) -server string hostname and port to use when connecting to LND. (default "localhost:10009") -time-between-retries duration time to wait before running a retry. (default 30s) -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. It can also take a --tip <amount> parameter if you want to tip me some satoshis.