lnd: integrate leader elector to lnd main

This commit also changes the order of DB init to be run after the RPC
server is up. This will allow us to later add an RPC endpoint to be used
to query leadership status.
This commit is contained in:
Andras Banki-Horvath committed 2021-05-04 17:33:08 +02:00
1 parent 41532ce634
commit d161b34ee5
4 files changed
+117 -15

No files matched your search

+4
View File
@@ -366,6 +366,8 @@ type Config struct {
DB *lncfg.DB `group:"db" namespace:"db"`
Cluster *lncfg.Cluster `group:"cluster" namespace:"cluster"`
// LogWriter is the root logger that all of the daemon's subloggers are
// hooked up to.
LogWriter *build.RotatingLogWriter
@@ -532,6 +534,7 @@ func DefaultConfig() Config {
MaxCommitFeeRateAnchors: lnwallet.DefaultAnchorsCommitMaxFeeRateSatPerVByte,
LogWriter: build.NewRotatingLogWriter(),
DB: lncfg.DefaultDB(),
Cluster: lncfg.DefaultCluster(),
registeredChains: chainreg.NewChainRegistry(),
ActiveNetParams: chainreg.BitcoinTestNetParams,
ChannelCommitInterval: defaultChannelCommitInterval,
@@ -1372,6 +1375,7 @@ func ValidateConfig(cfg Config, usageMessage string,
cfg.Caches,
cfg.WtClient,
cfg.DB,
cfg.Cluster,
cfg.HealthChecks,
)
if err != nil {