From cbab298154b85c37c23cf19f0e07aa0716bd258d Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Wed, 17 Oct 2018 16:09:34 -0700 Subject: [PATCH] chan_series: filter out nodes who intend to remain private In this commit, we filter out nodes who intend to remain private. We do this to prevent leaking information about them by forwarding their NodeAnnouncements. --- chan_series.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/chan_series.go b/chan_series.go index 83b05b02..7f592503 100644 --- a/chan_series.go +++ b/chan_series.go @@ -89,6 +89,22 @@ func (c *chanSeries) UpdatesInHorizon(chain chainhash.Hash, return nil, err } for _, nodeAnn := range nodeAnnsInHorizon { + // Ensure we only forward nodes that are publicly advertised to + // prevent leaking information about nodes. + isNodePublic, err := c.graph.IsPublicNode(nodeAnn.PubKeyBytes) + if err != nil { + srvrLog.Errorf("Unable to determine if node %x is "+ + "advertised: %v", nodeAnn.PubKeyBytes, err) + continue + } + + if !isNodePublic { + srvrLog.Tracef("Skipping forwarding announcement for "+ + "node %x due to being unadvertised", + nodeAnn.PubKeyBytes) + continue + } + nodeUpdate, err := nodeAnn.NodeAnnouncement(true) if err != nil { return nil, err