graph: move topology subscription to ChannelGraph - #9577
Conversation
|
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 (
|
yyforyongyu
left a comment
There was a problem hiding this comment.
Beautiful - the overall arch finally starts to look cool now😎
| ) | ||
| } | ||
|
|
||
| // No need to send topology updates for shell nodes. |
There was a problem hiding this comment.
it's a node that we only know about via a channel announcement that we have not received a channel update for yet
There was a problem hiding this comment.
i'll add this comment
There was a problem hiding this comment.
wait im also just gonna double check that this is actually needed. Now thinking about it, shell node anns should not come through here. but I remember i had to add this since they were coming through here.
Gimme a min
There was a problem hiding this comment.
ok yeah we defs dont need this check.
itests all fine as this is only ever called from the gossiper which does a conversion from lnwire msg to model message and explicitly sets HaveNodeAnnouncement to true.
The issue was coming from unit tests in this package. So im removing this check and ensuring the unit tests pass by setting all expected fields for the models.LightningNode type.
There was a problem hiding this comment.
ok adding some detailed info here just to make the changes im going to push here very clear:
So the failing test is TestPartialNode which currently tests that we can add a "Shell node" via the ChannelGraphs AddLightningNode method. It does an assertNodeInCache check too to ensure that this node is seen in the cache. However, as of today in master: this does not actually test what happens in reality. Today, we never add partial nodes (shell nodes) via this method. In reality, we only ever add these nodes (persist and add to cache) at the CRUD level via AddChannelEdge.
Lines 1143 to 1162 in 9feb761
So, I've added an initial commit to fix the test so that it tests the correct flow.
The test as it stands today does not make sense as it adds a Partial/Shell node to the graph via AddLightningNode which will never happen since this is only ever triggered by the gossiper which only calls the method with a full node announcement. Shell/Partial nodes are only ever added via AddChannelEdge which will insert a partial node if we are adding a channel edge which has node pub keys that we dont have a node entry for. So we adjust the test to use this more accurate flow.
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.
|
soz for the re-request review yall, just wanna make sure you guys are ok with the final update here 🙏 see this thread for more flavour: #9577 (comment) |
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
ChannelGraphso that we can send updates we receivefrom the remote graph.
Part of #9494