From fb8214b808e7d0f562a470ae96b974be44fc83e8 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Thu, 13 Jun 2019 17:29:28 -0700 Subject: [PATCH] config: expose+validate private tower addr --- config.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index 3cce0d55..2a775072 100644 --- a/config.go +++ b/config.go @@ -32,6 +32,7 @@ import ( "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/routing" "github.com/lightningnetwork/lnd/tor" + "github.com/lightningnetwork/lnd/watchtower" ) const ( @@ -315,6 +316,8 @@ type config struct { Caches *lncfg.Caches `group:"caches" namespace:"caches"` Prometheus lncfg.Prometheus `group:"prometheus" namespace:"prometheus"` + + WtClient *lncfg.WtClient `group:"wtclient" namespace:"wtclient"` } // loadConfig initializes and parses the config using a config file and command @@ -1051,15 +1054,27 @@ func loadConfig() (*config, error) { "minbackoff") } - // Validate the subconfigs for workers and caches. + // Validate the subconfigs for workers, caches, and the tower client. err = lncfg.Validate( cfg.Workers, cfg.Caches, + cfg.WtClient, ) if err != nil { return nil, err } + // If the user provided private watchtower addresses, parse them to + // obtain the LN addresses. + if cfg.WtClient.IsActive() { + err := cfg.WtClient.ParsePrivateTowers( + watchtower.DefaultPeerPort, cfg.net.ResolveTCPAddr, + ) + if err != nil { + return nil, err + } + } + // Finally, ensure that the user's color is correctly formatted, // otherwise the server will not be able to start after the unlocking // the wallet.