-
Notifications
You must be signed in to change notification settings - Fork 404
Limit amount of hints resulting from filter_channels to 3 #1919
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
Limit amount of hints resulting from filter_channels to 3 #1919
Conversation
Codecov ReportBase: 90.77% // Head: 90.73% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1919 +/- ##
==========================================
- Coverage 90.77% 90.73% -0.05%
==========================================
Files 94 94
Lines 49603 49603
Branches 49603 49603
==========================================
- Hits 45026 45006 -20
- Misses 4577 4597 +20
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
LGTM after squash
Please squash commits as described at https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits |
84c5b5e
to
d73bb08
Compare
Great thanks for the contribution! If you have the possibility to do so, it would great if you add test coverage of this case, as our current test coverage covers all filtering variations that I know of. Have a look at the other tests in the same file you've been updating and see if you can add test coverage. If you'd prefer to not add the test coverage, I can do so in a follow-up instead. A general discussion point I'd like to point out for everyone: For phantom invoices, with the change of this PR, the route hints will still be really large if we for example have 3 participating nodes with 3 channels to different counterparties each. Would we like this to only include 3 (or maybe some other number) channels in total for phantom invoices given that we have users that runs a phantom node setup for mobile as well, or are we ok with including more channels for phantom invoices for now (9 in the example I gave)? |
My pleasure :). I will be quite busy with school over the next few days, but I will possibly have some time tomorrow or early next week to look into adding the new coverage. |
Nice, thanks! Let me know if you'd need any help once you've had time to look into it :). |
Yes, good point, we should really limit to one channel per phantom node. Note that the current PR actually still randomizes! The ordering is currently controlled by the I'm not sure what the "right" answer here is, it probably depends a bit on what we think the intended use-case is - I think, mostly, private nodes simply won't have more than one or two channels to begin with, so it doesn't matter all that much. Given that, we can be lazy and just sort by something dumb, eg return the top two channels by node_id or channel_id or whatever. If we want to do something more clever, we could shuffle by the high bits in |
Any chance you want to pick this back up? |
If @cdmoss isn't free to resume this PR, I would be interested in picking it up. If I understand it, the outstanding items are:
I don't understand this part. |
In LDK there's support for generating invoices that can be paid to multiple receiving nodes, without making it obvious to the payer that those nodes may be the final destination. This concept is called Phantom payments and you can be read more about it here: These types of invoices are generated through the |
Picking this up now, sorry for the delay.
Limiting hints for phantom nodes to 1 breaks two of the existing unit tests because they specifically test multi-node cases:
These tests don't really make much sense in a world where phantom nodes only have one hint (other than asserting that the code only selects one hint when multiple would have been eligible). Does it make sense to rather try move this coverage to |
We should maybe consider doing the limiting at the |
Closing as abandoned and superseded by #2044. |
As per #1782, filter_channels will only take 20 channels from the selected channels and shuffles the channel list before returning it.