Skip to content
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

WIP: A new plugin to find good peers | explore the LN #82

Closed
wants to merge 8 commits into from

Conversation

darosior
Copy link
Member

The algorithm is a bit sketchy but it can be improved over time, and I already made some good finds with the plugin.

Copy link
Contributor

@cdecker cdecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice plugin, just some minor suggestions.

Seeing that this overlaps in scope with the autopilot plugin, would it make sense to merge the two?

goodpeer/goodpeer.py Show resolved Hide resolved
goodpeer/goodpeer.py Outdated Show resolved Hide resolved

def get_medians(channels):
"""
Return the (median_base_fee, median_fees_ppm) of the given peer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which direction are you considering here? Or does that not matter? I would have expected merchants to look for nodes with a small incoming fee, and end-users for a small outgoing fee.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, I was only considering end-user here !

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Considered outgoing fees)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added another optional parameter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the direction argument doesn't make that much sense, as when scanning nodes I take the fees this node sets (source), taking the fees its peers set (destination) doesn't seem relevant.

I would have expected merchants to look for nodes with a small incoming fee, and end-users for a small outgoing fee.

Re-thinking it I had outgoing fees in mind in any case, and assumed that if we fund a channel to a peer which always set somewhat small outgoing fees, it would set it to us too. So that we can route through it, and receive through it.

goodpeer/goodpeer.py Outdated Show resolved Hide resolved
@darosior
Copy link
Member Author

Seeing that this overlaps in scope with the autopilot plugin, would it make sense to merge the two?

Ah I've never read the autopilot. Since this is just part of it maybe it can just be duplicated ? I'd like to use this without autopilot, maybe so do other users.

@darosior darosior force-pushed the goodpeers branch 2 times, most recently from 9f36355 to fa46bed Compare January 18, 2020 16:20
@darosior
Copy link
Member Author

Removed the just added direction parameter

@cdecker
Copy link
Contributor

cdecker commented Jan 19, 2020

Seeing that this overlaps in scope with the autopilot plugin, would it make sense to merge the two?

Ah I've never read the autopilot. Since this is just part of it maybe it can just be duplicated ? I'd like to use this without autopilot, maybe so do other users.

The autopilot doesn't really do anything unless you call the exposed RPC commands, and even most of the commands are just suggestions, kind of a discovery mechanism. This is pretty similar in scope to that, that's why I'm suggesting it.

It's just a bit confusing for users to have multiple options to achieve the same goal, I think.

@darosior
Copy link
Member Author

I had to (re) open channels recently, which permitted me to tweak the results:

  • The filters were too low. 20$ isnt enough
  • The average fees can be a secondary metric
  • Add the possibility to filter out old channels, fees policy may have changed since

Median is great, but a lot of the results will have the same score if we
restrict the scoring to just that.
We apply a <1 factor to the mean though, as it would otherwise distort
the result otherwise.
Useful to filter out channels established a while ago
Copy link
Contributor

@renepickhardt renepickhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would strongly suggest to extend lib autopilot. And have everything with suggesting nodes / channels in one place.

I have more ideas of suggesting channels based on the potential ability to rebalance making use of the recent research results. As far as I understand your plugin this does actually go in this direction.

@darosior
Copy link
Member Author

darosior commented Feb 5, 2020

Late reply: I need to read the autopilot to integrate it, but I've thought a bit more about that and I think I'm going to extend this to be more kind of an "explorer" as soon as I can. Marking WIP then.

@darosior darosior changed the title A new plugin to find peers WIP: A new plugin to find good peers | explore the LN Feb 5, 2020
@cdecker cdecker marked this pull request as draft August 28, 2020 14:45
Copy link
Member

@m-schmoock m-schmoock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. Tested and works as promised.
This has been dormant for a while, are we go with this?
Needs rebase for the readme... and anyway some nits:

I have a docstring warning in the RPC method:

INFO    plugin-goodpeer.py: RPC method 'goodpeers' does not have a docstring.

Additional we have some W504 nits:

goodpeer/goodpeer.py:55:45: W504 line break after binary operator
goodpeer/goodpeer.py:82:49: W504 line break after binary operator
goodpeer/goodpeer.py:84:47: W504 line break after binary operator

@cdecker I think we can allow W504 (maybe also in main repo) as I think it increases readability when used like in the above occurences.

goodpeers_small_desc = "Get a list of good enough peers to connect to, reversely sorted."

goodpeers_desc = \
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: E122 continuation line missing indentation or outdented

@plugin.method("goodpeers", desc=goodpeers_small_desc,
long_desc=goodpeers_desc)
def goodpeers(plugin, bias=None, min_height=None, **kwargs):
nodes = get_nodes(plugin)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use the docstring here, maybe instead of the desc_long=... above.

@darosior
Copy link
Member Author

darosior commented Nov 30, 2020 via email

@m-schmoock
Copy link
Member

@darosior "blackfridaypeers" :D

One thing that came to my mind is that it would be good to limit the output to just the best 20 peers or something, maybe a parameter that can be set to 100 or all if one wants more output.

@cdecker cdecker closed this Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants