-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
graph: move topology subscription to ChannelGraph
#9577
base: elle-graphCacheBase
Are you sure you want to change the base?
graph: move topology subscription to ChannelGraph
#9577
Conversation
We plan to later on add an option for a remote graph source which will be managed from the ChannelGraph. In such a set-up, a node would rely on the remote graph source for graph updates instead of from gossip sync. In this scenario, however, our topology subscription logic should still notify clients of all updates and so it makes more sense to have the logic as part of the ChannelGraph so that we can send updates we receive from the remote graph.
A clean-up commit just to separate out all topology related fields in ChannelGraph into a dedicated struct that then gets mounted to the ChannelGraph.
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful - the overall arch finally starts to look cool now😎
@@ -234,6 +316,17 @@ func (c *ChannelGraph) AddLightningNode(node *models.LightningNode, | |||
) | |||
} | |||
|
|||
// No need to send topology updates for shell nodes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: what is a shell node?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a node that we only know about via a channel announcement that we have not received a channel update for yet
// add a new notification client, or cancel notifications for an | ||
// existing client. | ||
ntfnClientUpdates chan *topologyClientUpdate | ||
*topologyManager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
// We'll notify any registered clients. | ||
case update := <-c.topologyUpdate: | ||
c.wg.Add(1) | ||
go c.handleTopologyUpdate(update) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one day we will get there...but goroutine inside goroutine is bad...per-exisiting tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed this offline, could you please also add a TODO so we can clean this up?
@@ -127,23 +127,22 @@ func (b *Builder) notifyTopologyChange(topologyDiff *TopologyChange) { | |||
len(topologyDiff.ChannelEdgeUpdates), | |||
len(topologyDiff.ClosedChannels)) | |||
|
|||
go func(c *topologyClient) { | |||
defer c.wg.Done() | |||
go func(t *topologyClient) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok i didn't realize we were firing goroutine inside goroutine inside yet anther goroutine😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it's all very gross 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fine though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesomeness! LGTM ✨
// We'll notify any registered clients. | ||
case update := <-c.topologyUpdate: | ||
c.wg.Add(1) | ||
go c.handleTopologyUpdate(update) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed this offline, could you please also add a TODO so we can clean this up?
@@ -127,23 +127,22 @@ func (b *Builder) notifyTopologyChange(topologyDiff *TopologyChange) { | |||
len(topologyDiff.ChannelEdgeUpdates), | |||
len(topologyDiff.ClosedChannels)) | |||
|
|||
go func(c *topologyClient) { | |||
defer c.wg.Done() | |||
go func(t *topologyClient) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be fine though.
We plan to later on add an option for a remote graph source which will
be managed from the
ChannelGraph
. In such a set-up, a node would rely onthe remote graph source for graph updates instead of from gossip sync.
In this scenario, however, our topology subscription logic should still
notify clients of all updates and so it makes more sense to have the
logic as part of the
ChannelGraph
so that we can send updates we receivefrom the remote graph.
Part of #9494