mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-12 14:12:27 +02:00
lnd+signal: implement systemd notify
This adds support for notifying systemd about the state of LND. It notifies systemd just before waiting for wallet password or, if `wallet-password-file` was specified, right after unlocking the wallet. This means that "ready" represents RPC being available for intended use. It's intentional, so that client services can use `After=` in `systemd` configuration to avoid misleading error messages about missing files or refused connections. Part of #4470
This commit is contained in:
8
lnd.go
8
lnd.go
@ -537,6 +537,10 @@ func Main(cfg *Config, lisCfg ListenerCfg, interceptor signal.Interceptor) error
|
||||
// to the default behavior of waiting for the wallet creation/unlocking
|
||||
// over RPC.
|
||||
default:
|
||||
if err := interceptor.Notifier.NotifyReady(false); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
params, err := waitForWalletPassword(
|
||||
cfg, pwService, []btcwallet.LoaderOption{dbs.walletDB},
|
||||
interceptor.ShutdownChannel(),
|
||||
@ -893,6 +897,10 @@ func Main(cfg *Config, lisCfg ListenerCfg, interceptor signal.Interceptor) error
|
||||
// We transition the RPC state to Active, as the RPC server is up.
|
||||
interceptorChain.SetRPCActive()
|
||||
|
||||
if err := interceptor.Notifier.NotifyReady(true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// If we're not in regtest or simnet mode, We'll wait until we're fully
|
||||
// synced to continue the start up of the remainder of the daemon. This
|
||||
// ensures that we don't accept any possibly invalid state transitions, or
|
||||
|
Reference in New Issue
Block a user