-
Notifications
You must be signed in to change notification settings - Fork 120
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
Conversation
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 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
Outdated
|
||
def get_medians(channels): | ||
""" | ||
Return the (median_base_fee, median_fees_ppm) of the given peer. |
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.
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.
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.
Ah right, I was only considering end-user here !
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.
(Considered outgoing fees)
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 added another optional parameter
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.
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.
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. |
9f36355
to
fa46bed
Compare
Removed the just added |
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. |
I had to (re) open channels recently, which permitted me to tweak the results:
|
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
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 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.
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. |
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.
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 = \ | ||
""" |
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.
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) |
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 should use the docstring here, maybe instead of the desc_long=...
above.
Thanks for giving it a look :-)
I have mixed feelings about this plugin:
- I think it should certainly not be in autopilot, now that we have CLBOSS i think we should focus here on smaller parts of what consists a comprehensive autopilot so people (and us actually) can choose to run only smaller parts.
- I think it's great and got me great finds. However, the best peers to connect to are.. A way more complicated matter. If we merge this i should probably rename it to "blackfridaypeers" :p
- I'm still thinking about the explorer i mentioned previously. It will probably be called "edges" and will allow research of peers sorted by new edges created, which could be weighted. It will be a completely new plugin however and should not condition the fortune of this one :)
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
Le lundi, novembre 30, 2020 11:28 AM, Michael Schmoock <notifications@github.com> a écrit :
… @m-schmoock approved this pull request.
ACK. Tested and works as promised.
This has been dormant for a while, are we go with this?
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
***@***.***(https://github.com/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.
---------------------------------------------------------------
In [goodpeer/descriptions.py](#82 (comment)):
> @@ -0,0 +1,15 @@
+goodpeers_small_desc = "Get a list of good enough peers to connect to, reversely sorted."
+
+goodpeers_desc = \
+"""
Nit: E122 continuation line missing indentation or outdented
---------------------------------------------------------------
In [goodpeer/goodpeer.py](#82 (comment)):
> + return median_base, median_ppm, avg_base, avg_ppm
+
+
+def reverse_sort(nodes):
+ """
+ Reversely sort the nodes, the lower the score the better.
+ """
+ # Python3.5 hasn't native dicts ordered.. So use OrderedDict
+ return OrderedDict(sorted(nodes.items(),
+ key=lambda item: item[1]["score"], reverse=True))
+
+
***@***.***
("goodpeers", desc=goodpeers_small_desc,
+ long_desc=goodpeers_desc)
+def goodpeers(plugin, bias=None, min_height=None, **kwargs):
+ nodes = get_nodes(plugin)
We should use the docstring here, maybe instead of the desc_long=... above.
—
You are receiving this because you authored the thread.
Reply to this email directly, [view it on GitHub](#82 (review)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AFLK3FYO4G6MBZQASVROMLTSSNXUJANCNFSM4KFZKLZA).
|
@darosior "blackfridaypeers" :D One thing that came to my mind is that it would be good to limit the output to just the best |
The algorithm is a bit sketchy but it can be improved over time, and I already made some good finds with the plugin.