Skip to content

Commit 01f28ba

Browse files
committed
server+discovery: alias-handling in gossiper
An OptionalMsgField has been added that allows outside subsystems to provide a short channel id we should insert into a ChannelUpdate that we then sign and send to our peer. When the gossiper receives a ChannelUpdate, it will query the alias manager by the passed-in FindBaseByAlias function to determine if the short channel id in the ChannelUpdate points to a known channel. If this lookup returns an error, we'll fallback to using the original id in the ChannelUpdate when querying the router. The lookup and potential fallback must occur in order to properly lock the multimutex, query the correct router channels, and rate limit the correct short channel id. An unfortunate side effect of receiving ChannelUpdates from our peer that reference on of our aliases rather than the real SCID is that we must store this policy. Yet it is not broadcast-able. Care has been taken to ensure the gossiper does not broadcast *any* ChannelUpdate with an alias SCID. The cachedNetworkMsg uses the new processedNetworkMsg struct. This is necessary so that delete-and-reinsert in the funding manager doesn't process a ChannelUpdate twice and end up in a deadlock since the err chan is no longer being used.
1 parent 15b871d commit 01f28ba

File tree

4 files changed

+282
-28
lines changed

4 files changed

+282
-28
lines changed

channeldb/graph.go

+12-2
Original file line numberDiff line numberDiff line change
@@ -2167,8 +2167,18 @@ func (c *ChannelGraph) FilterChannelRange(startHeight,
21672167

21682168
// We'll now iterate through the database, and find each
21692169
// channel ID that resides within the specified range.
2170-
for k, _ := cursor.Seek(chanIDStart[:]); k != nil &&
2171-
bytes.Compare(k, chanIDEnd[:]) <= 0; k, _ = cursor.Next() {
2170+
for k, v := cursor.Seek(chanIDStart[:]); k != nil &&
2171+
bytes.Compare(k, chanIDEnd[:]) <= 0; k, v = cursor.Next() {
2172+
// Don't send alias SCIDs during gossip sync.
2173+
edgeReader := bytes.NewReader(v)
2174+
edgeInfo, err := deserializeChanEdgeInfo(edgeReader)
2175+
if err != nil {
2176+
return err
2177+
}
2178+
2179+
if edgeInfo.AuthProof == nil {
2180+
continue
2181+
}
21722182

21732183
// This channel ID rests within the target range, so
21742184
// we'll add it to our returned set.

0 commit comments

Comments
 (0)