lnd: use persisted addrs if not set in config
What changed, and why it matters
This small change makes LND reuse previously saved network addresses when the user has not configured any external IP addresses. It is a behavior fix that likely prevents a node from accidentally advertising no addresses after restart, which could make it unreachable on the Lightning Network. There is no direct evidence in the commit that this is a security fix, and no exploit is described.
Treat as a normal bugfix/availability improvement. Review whether empty ExternalIPs should ever override persisted addresses, and confirm the change does not cause stale or unintended addresses to be re-advertised. No urgent security action is indicated by the diff alone.
Security signals we found
Behavior change in node address advertisement
Possible availability/reachability improvement
No input validation or boundary changes visible
No explicit security context in commit message
Evidence from the diff
In server.go’s setSelfNode(), when ExternalIPs is empty in the configuration, the patch now copies srcNode.Addresses into the addrs slice. Previously addrs would remain empty in that path. This ensures the node’s announced addresses persist across restarts even if externalip is not re-specified. The change touches only address selection logic and does not add validation or authentication.
Changed components
lnd/server.goNode address advertisement logicConfiguration handling for externalipInspect captured patch +6 / −0
diff --git a/server.go b/server.go
index 9c29adf..b7e498a 100644
--- a/server.go
+++ b/server.go
@@ -5595,6 +5595,12 @@ func (s *server) setSelfNode(ctx context.Context, nodePub route.Vertex,
alias = srcNode.Alias
}
+ // If the `externalip` is not specified in the config, it means
+ // `addrs` will be empty, we'll use the source node's addresses.
+ if len(s.cfg.ExternalIPs) == 0 {
+ addrs = srcNode.Addresses
+ }
+
case errors.Is(err, graphdb.ErrSourceNodeNotSet):
// If an alias is not specified in the config, we'll use the
// default, which is the first 10 bytes of the serialized
Why this scored 32/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.