-
Notifications
You must be signed in to change notification settings - Fork 906
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
pyln: gossmap ... all the way #6012
pyln: gossmap ... all the way #6012
Conversation
f7db3d4
to
6544bfe
Compare
d862fb1
to
4888e96
Compare
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.
Forgot to submit my reviews, not to mention actually finish reviewing :-) Anyway, I'll pick this up asap
4888e96
to
c6ea2f5
Compare
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.
Very nice PR, with some interesting tricks in there, thanks :-)
I found a couple minor things, but this could go forward as is.
99ee3a4
to
210efa1
Compare
@cdecker Applied your suggestions (except the I was thinking about adding a This can even be made in a way that when a callback/lambda is passed it applies this to all half_channels it comes across to find out if a channel should be considered or not. This way a user/programmer can descide to filter on anything it wants. |
Or maybe add some basic routing :D Currently I'm testing this beefed up gossmap implementation on mainnet data |
This looks promising, when I load full mainnet data, the initial load takes some time ofc, but complex querying is good:
Maybe we can improve initial load performance somehow... |
Looking good 👍 That initial load time can likely be reduced, but profiles will likely tell us how. The C gossmap is rather clever in that it creates an index over the |
74b8395
to
e0f3009
Compare
e0f3009
to
6ba37dd
Compare
@cdecker thanks, I applied a lot from your suggestions directly and resolved them. Some are still open, there I applied what I can and asked some questions back on others... |
def has_feature(self, bit): | ||
return 1 << bit & self.features > 0 | ||
|
||
def has_feature_odd(self, bit): | ||
return 2 << bit & self.features > 0 | ||
|
||
def has_features(self, bitmask): | ||
return bitmask & self.features == bitmask |
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.
I don't think these functions are generally useful. Most commonly, you want all nodes which support feature_foo, you want "features & (3 << foo) != 0". Call that "has_feature()". Then you can have "has_compulsory_feature()" and "has_optional_feature()".
has_features() should almost certainly use the "has_feature" logic, too.
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.
Please fix this. This API is terrible!
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.
Yes I did that now, can you re-check?
Oh, and needs a Changelog-Added indicating that pyln.client.gossmap has seen significant functionality improvements. |
f79fc65
to
710a15c
Compare
710a15c
to
37a9191
Compare
I rebased again (trivial, to remove conflict in test_misc.py) before I realized you still didn't:
Also, the commit message for |
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.
A little more cleanup, see comment....
This method is no longer used in cln nor in the plugins repo. Changelog-None
This can be adapted and used to create test gossip stores. The test is just skipped by design as it would fail on intention.
- moves offset into GossipHeader hdr which is passed to all constuctors - reads .flags as u16 instead of extracting it from the .length, see 0274d88 - adds zombie and ratelimit flag to GossipHeader - bytes_read start at 0 instead of 1 which is more correct, the one byte is then corrected for when setting the offset of new header. - bytes_read is increased in pull_bytes as this is the only place where something is read - use new style for various format-strings
Also caches certain __hash__ and __str__ operations, This way graph operations can be done quicker.
also makes them acessible using bitmask functions
48effcb
to
b9e1a3a
Compare
Includes a lot of useful filters and statistical methods. To see a gossip_store summary: ``` s = GossmapStats(g) s.print_stats() ```
Changelog-Added: pyln-client: Improvements on the gossmap implementation
b9e1a3a
to
4d199b7
Compare
Excellent! Ack 4d199b7 |
I did some work on the python gossmap implementation.
Let's see how it goes...
Update: I added a lot of missing and useful functionality to operate-on/analyse gossip stores and also use that for plugins that do network analysis and optimization.
node_announcement
metadata addresses, alias, rgb, ...get_nodes()
methods that can return filtered subsets of the graph.get_halfchannels()
method that can be used to return an area of channels with a given distance (depth
) towards or from a certain node