Fix the ability to disable p2p listening

This commit is contained in:
Yaacov Akiba Slama 2018-07-03 07:54:17 +03:00
parent 9205720bea
commit c9c47b3a51

@ -812,13 +812,6 @@ func loadConfig() (*config, error) {
return nil, err
}
// Remove the listening addresses specified if listening is disabled.
if cfg.DisableListen {
ltndLog.Infof("Listening on the p2p interface is disabled!")
cfg.Listeners = nil
cfg.ExternalIPs = nil
}
// Add default port to all RPC listener addresses if needed and remove
// duplicate addresses.
cfg.RPCListeners, err = lncfg.NormalizeAddresses(
@ -839,6 +832,13 @@ func loadConfig() (*config, error) {
return nil, err
}
// Remove the listening addresses specified if listening is disabled.
if cfg.DisableListen {
ltndLog.Infof("Listening on the p2p interface is disabled!")
cfg.Listeners = nil
cfg.ExternalIPs = nil
} else {
// Add default port to all listener addresses if needed and remove
// duplicate addresses.
cfg.Listeners, err = lncfg.NormalizeAddresses(
@ -870,6 +870,7 @@ func loadConfig() (*config, error) {
return nil, err
}
}
}
// Finally, ensure that we are only listening on localhost if Tor
// inbound support is enabled.