|
5 | 5 | "time"
|
6 | 6 |
|
7 | 7 | "github.com/btcsuite/btcd/chaincfg/chainhash"
|
8 |
| - "github.com/lightningnetwork/lnd/fn/v2" |
9 | 8 | graphdb "github.com/lightningnetwork/lnd/graph/db"
|
10 | 9 | "github.com/lightningnetwork/lnd/lnwire"
|
11 | 10 | "github.com/lightningnetwork/lnd/netann"
|
@@ -121,12 +120,8 @@ func (c *ChanSeries) UpdatesInHorizon(chain chainhash.Hash,
|
121 | 120 | if err != nil {
|
122 | 121 | return nil, err
|
123 | 122 | }
|
124 |
| - chansInHorizon := fn.Collect(chansInHorizonIter) |
125 | 123 |
|
126 |
| - // nodesFromChan records the nodes seen from the channels. |
127 |
| - nodesFromChan := make(map[[33]byte]struct{}, len(chansInHorizon)*2) |
128 |
| - |
129 |
| - for _, channel := range chansInHorizon { |
| 124 | + for channel := range chansInHorizonIter { |
130 | 125 | // If the channel hasn't been fully advertised yet, or is a
|
131 | 126 | // private channel, then we'll skip it as we can't construct a
|
132 | 127 | // full authentication proof if one is requested.
|
@@ -187,47 +182,19 @@ func (c *ChanSeries) UpdatesInHorizon(chain chainhash.Hash,
|
187 | 182 |
|
188 | 183 | // Append the all the msgs to the slice.
|
189 | 184 | updates = append(updates, chanUpdates...)
|
190 |
| - |
191 |
| - // Record the nodes seen. |
192 |
| - nodesFromChan[channel.Info.NodeKey1Bytes] = struct{}{} |
193 |
| - nodesFromChan[channel.Info.NodeKey2Bytes] = struct{}{} |
194 | 185 | }
|
195 | 186 |
|
196 | 187 | // Next, we'll send out all the node announcements that have an update
|
197 | 188 | // within the horizon as well. We send these second to ensure that they
|
198 | 189 | // follow any active channels they have.
|
199 | 190 | nodeAnnsInHorizon, err := c.graph.NodeUpdatesInHorizon(
|
200 |
| - startTime, endTime, |
| 191 | + startTime, endTime, graphdb.WithIterPublicNodesOnly(), |
201 | 192 | )
|
202 | 193 | if err != nil {
|
203 | 194 | return nil, err
|
204 | 195 | }
|
205 | 196 |
|
206 | 197 | for nodeAnn := range nodeAnnsInHorizon {
|
207 |
| - // If this node has not been seen in the above channels, we can |
208 |
| - // skip sending its NodeAnnouncement. |
209 |
| - if _, seen := nodesFromChan[nodeAnn.PubKeyBytes]; !seen { |
210 |
| - log.Debugf("Skipping forwarding as node %x not found "+ |
211 |
| - "in channel announcement", nodeAnn.PubKeyBytes) |
212 |
| - continue |
213 |
| - } |
214 |
| - |
215 |
| - // Ensure we only forward nodes that are publicly advertised to |
216 |
| - // prevent leaking information about nodes. |
217 |
| - isNodePublic, err := c.graph.IsPublicNode(nodeAnn.PubKeyBytes) |
218 |
| - if err != nil { |
219 |
| - log.Errorf("Unable to determine if node %x is "+ |
220 |
| - "advertised: %v", nodeAnn.PubKeyBytes, err) |
221 |
| - continue |
222 |
| - } |
223 |
| - |
224 |
| - if !isNodePublic { |
225 |
| - log.Tracef("Skipping forwarding announcement for "+ |
226 |
| - "node %x due to being unadvertised", |
227 |
| - nodeAnn.PubKeyBytes) |
228 |
| - continue |
229 |
| - } |
230 |
| - |
231 | 198 | nodeUpdate, err := nodeAnn.NodeAnnouncement(true)
|
232 | 199 | if err != nil {
|
233 | 200 | return nil, err
|
|
0 commit comments