Skip to content

Conversation

@nepet
Copy link
Member

@nepet nepet commented Mar 6, 2025

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.

@nepet nepet requested review from JssDWt and cdecker March 6, 2025 17:48
@nepet nepet force-pushed the 2510-better-channel-selection-logic branch from 5d19f06 to 3661788 Compare March 27, 2025 09:32
@nepet nepet force-pushed the 2510-better-channel-selection-logic branch from 3661788 to 133d5da Compare April 8, 2025 12:39
@nepet nepet requested a review from JssDWt April 8, 2025 14:12
@nepet
Copy link
Member Author

nepet commented Apr 8, 2025

@JssDWt If you don't mind it would be nice to get your oppinion on the improved version!

Copy link
Collaborator

@JssDWt JssDWt left a comment

Choose a reason for hiding this comment

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

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's add a check that upper is not below lower.

@cdecker
Copy link
Collaborator

cdecker commented Apr 11, 2025

Thanks guys, apart from the check that @JssDWt proposes this looks great, and we can add that safety check in a follow up. @nepet are you ok with me merging this as is?

nepet added 3 commits April 11, 2025 17:57
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>
@cdecker cdecker force-pushed the 2510-better-channel-selection-logic branch from 133d5da to 32e64c3 Compare April 11, 2025 15:57
@cdecker cdecker merged commit face259 into main Apr 15, 2025
11 checks passed
@cdecker cdecker deleted the 2510-better-channel-selection-logic branch April 15, 2025 11:53
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.

4 participants