mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 07:00:55 +02:00
healthcheck: monitor access to chain backend
Add a new health check package which will periodically poll health check functions and shutdown if we do not succeed after our set number of attempts. The first check that we add is one for our chain backend, to ensure that we are connected to a bitcoin node.
This commit is contained in:
16
config.go
16
config.go
@@ -86,6 +86,11 @@ const (
|
||||
// HostAnnouncer will wait between DNS resolutions to check if the
|
||||
// backing IP of a host has changed.
|
||||
defaultHostSampleInterval = time.Minute * 5
|
||||
|
||||
defaultChainInterval = time.Minute
|
||||
defaultChainTimeout = time.Second * 10
|
||||
defaultChainBackoff = time.Second * 30
|
||||
defaultChainAttempts = 3
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -265,6 +270,8 @@ type Config struct {
|
||||
|
||||
AllowCircularRoute bool `long:"allow-circular-route" description:"If true, our node will allow htlc forwards that arrive and depart on the same channel."`
|
||||
|
||||
HealthChecks *lncfg.HealthCheckConfig `group:"healthcheck" namespace:"healthcheck"`
|
||||
|
||||
DB *lncfg.DB `group:"db" namespace:"db"`
|
||||
|
||||
// LogWriter is the root logger that all of the daemon's subloggers are
|
||||
@@ -383,6 +390,14 @@ func DefaultConfig() Config {
|
||||
Watchtower: &lncfg.Watchtower{
|
||||
TowerDir: defaultTowerDir,
|
||||
},
|
||||
HealthChecks: &lncfg.HealthCheckConfig{
|
||||
ChainCheck: &lncfg.CheckConfig{
|
||||
Interval: defaultChainInterval,
|
||||
Timeout: defaultChainTimeout,
|
||||
Attempts: defaultChainAttempts,
|
||||
Backoff: defaultChainBackoff,
|
||||
},
|
||||
},
|
||||
MaxOutgoingCltvExpiry: htlcswitch.DefaultMaxOutgoingCltvExpiry,
|
||||
MaxChannelFeeAllocation: htlcswitch.DefaultMaxLinkFeeAllocation,
|
||||
LogWriter: build.NewRotatingLogWriter(),
|
||||
@@ -1124,6 +1139,7 @@ func ValidateConfig(cfg Config, usageMessage string) (*Config, error) {
|
||||
cfg.Caches,
|
||||
cfg.WtClient,
|
||||
cfg.DB,
|
||||
cfg.HealthChecks,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user