Merge pull request #1498 from yaslama/fix-1488

Fix the ability to disable p2p listening
This commit is contained in:
Olaoluwa Osuntokun 2018-07-03 22:40:02 -05:00 committed by GitHub
commit d83f4fbb85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -830,13 +830,6 @@ func loadConfig() (*config, error) {
return nil, err 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 // Add default port to all RPC listener addresses if needed and remove
// duplicate addresses. // duplicate addresses.
cfg.RPCListeners, err = lncfg.NormalizeAddresses( cfg.RPCListeners, err = lncfg.NormalizeAddresses(
@ -857,6 +850,13 @@ func loadConfig() (*config, error) {
return nil, err 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 // Add default port to all listener addresses if needed and remove
// duplicate addresses. // duplicate addresses.
cfg.Listeners, err = lncfg.NormalizeAddresses( cfg.Listeners, err = lncfg.NormalizeAddresses(
@ -888,6 +888,7 @@ func loadConfig() (*config, error) {
return nil, err return nil, err
} }
} }
}
// Finally, ensure that we are only listening on localhost if Tor // Finally, ensure that we are only listening on localhost if Tor
// inbound support is enabled. // inbound support is enabled.