multi: use uptime api for bitcoind healthcheck if version > 0.15

The getblockchaininfo call in bitcoind uses a commonly used lock,
csmain, in bitcoind. This made the endpoint unsuitable for a health
check, because some nodes were seeing waits up to 5 minutes (!). This
commit updates our health check function to use the uptime api, provided
our bitcoind version is > 0.15, when the api was added. We do not need
to switch our health check for btcd, because it has more granular
locking.
This commit is contained in:
carla
2020-11-11 11:26:15 +02:00
parent 339a9d3915
commit ca3b36c4b1
2 changed files with 73 additions and 4 deletions

View File

@@ -1292,10 +1292,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
// will not run it.
chainHealthCheck := healthcheck.NewObservation(
"chain backend",
func() error {
_, _, err := cc.ChainIO.GetBestBlock()
return err
},
cc.HealthCheck,
cfg.HealthChecks.ChainCheck.Interval,
cfg.HealthChecks.ChainCheck.Timeout,
cfg.HealthChecks.ChainCheck.Backoff,