config: validate node color after reading config

This commit is contained in:
Conner Fromknecht 2018-10-24 22:10:18 -07:00
parent 5c6c966891
commit b0318e2b74
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -934,8 +934,8 @@ func loadConfig() (*config, error) {
} }
} }
// Finally, ensure that we are only listening on localhost if Tor // Ensure that we are only listening on localhost if Tor inbound support
// inbound support is enabled. // is enabled.
if cfg.Tor.V2 || cfg.Tor.V3 { if cfg.Tor.V2 || cfg.Tor.V3 {
for _, addr := range cfg.Listeners { for _, addr := range cfg.Listeners {
if lncfg.IsLoopback(addr.String()) { 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 // Warn about missing config file only after all other configuration is
// done. This prevents the warning on help messages and invalid // done. This prevents the warning on help messages and invalid
// options. Note this should go directly before the return. // options. Note this should go directly before the return.