From b0318e2b74001d08e5c246290f0fc476b4367c84 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Wed, 24 Oct 2018 22:10:18 -0700 Subject: [PATCH] config: validate node color after reading config --- config.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/config.go b/config.go index 26e4c522..ff51dedc 100644 --- a/config.go +++ b/config.go @@ -934,8 +934,8 @@ func loadConfig() (*config, error) { } } - // Finally, ensure that we are only listening on localhost if Tor - // inbound support is enabled. + // Ensure that we are only listening on localhost if Tor inbound support + // is enabled. if cfg.Tor.V2 || cfg.Tor.V3 { for _, addr := range cfg.Listeners { if lncfg.IsLoopback(addr.String()) { @@ -948,6 +948,14 @@ func loadConfig() (*config, error) { } } + // Finally, ensure that the user's color is correctly formatted, + // otherwise the server will not be able to start after the unlocking + // the wallet. + _, err = parseHexColor(cfg.Color) + if err != nil { + return nil, fmt.Errorf("Unable to parse node color: %v", err) + } + // Warn about missing config file only after all other configuration is // done. This prevents the warning on help messages and invalid // options. Note this should go directly before the return.