Trampoline: Improve channel selection logic#586
Merged
Conversation
JssDWt
reviewed
Mar 7, 2025
5d19f06 to
3661788
Compare
3661788 to
133d5da
Compare
Member
Author
|
@JssDWt If you don't mind it would be nice to get your oppinion on the improved version! |
JssDWt
reviewed
Apr 10, 2025
Collaborator
JssDWt
left a comment
There was a problem hiding this comment.
It looks very good to me! I can't find any real issues on the first pass.
| let lower = ch.min_htlc_out_msat; | ||
| let upper = ch.spendable_msat.min(target_msat); |
Collaborator
There was a problem hiding this comment.
Let's add a check that upper is not below lower.
Collaborator
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
It makes more sense to filter directly from the get go instead of skipping channels that have an unsufficient spendable_msat amount and can cause zero value htlcs. Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
The way we allocated channels for a trampoline payment could lead to a case where we could get stuck selecting channels for a payment when the rest amount was lower than the lower bound of the channel. This commit introduces a new selection logic that tries to be greedy first but will split payments more carefully if it is actually needded. Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
133d5da to
32e64c3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The way we allocated channels for a trampoline payment could lead to a case where we could get stuck selecting channels for a payment when the rest amount was lower than the lower bound of the channel.
This PR introduces a new selection logic that tries to be greedy first but will split payments more carefully if it is actually needded.
Reviewers: Please check carefully and let me know if you need more tests.