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

Skip channels used for probing based on available liquidity #156

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

tnull
Copy link
Collaborator

@tnull tnull commented Aug 16, 2023

Fixes #155.

As pre-flight probes might take up some of the available liquidity, we here introduce that channels whose available liquidity is less than the required amount times Config::probing_liquidity_limit_multiplier won't be used to send pre-flight probes.

(cc @TonyGiorgio)

@tnull tnull requested a review from jkczyz August 16, 2023 08:33
@tnull tnull force-pushed the 2023-08-refuse-large-probes branch 4 times, most recently from 2dfa7bf to 9c92be3 Compare August 16, 2023 09:38
@tnull tnull changed the title Pre-filter channels used for probing based on available liquidity Skip channels used for probing based on available liquidity Aug 16, 2023
@tnull tnull force-pushed the 2023-08-refuse-large-probes branch from 9c92be3 to 7d52209 Compare August 16, 2023 10:25
@moneyball moneyball self-requested a review August 16, 2023 13:32
@moneyball
Copy link

ACK

moneyball
moneyball previously approved these changes Aug 16, 2023
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
@TheBlueMatt
Copy link

Since ChannelManager upstream has a router in it, do we want to upstream the core guts here?

@tnull
Copy link
Collaborator Author

tnull commented Aug 16, 2023

Since ChannelManager upstream has a router in it, do we want to upstream the core guts here?

Sure, happy to.

@G8XSU
Copy link
Contributor

G8XSU commented Aug 16, 2023

So are we closing this PR in favor of upstream PR or we will upstream separately later?

@tnull
Copy link
Collaborator Author

tnull commented Aug 16, 2023

So are we closing this PR in favor of upstream PR or we will upstream separately later?

Nah, as we'd want to expose the same API anyways I'd just land this and migrate to use upstream's version after 0.0.117 is released.

Copy link
Contributor

@G8XSU G8XSU left a comment

Choose a reason for hiding this comment

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

LGTM for squash.

src/lib.rs Outdated Show resolved Hide resolved
@G8XSU
Copy link
Contributor

G8XSU commented Aug 16, 2023

Do we want to add testcases for this ?

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated
Comment on lines 1419 to 1420
if *remaining_liquidity
< path_value * self.config.probing_liquidity_limit_multiplier
Copy link

Choose a reason for hiding this comment

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

You'll have the same problem as before because the way the division is moved to the other side of the inequality as a multiplication. From the previous example:

remaining_liquidity: 100, 81, 62
path_value * self.config.probing_liquidity_limit_multiplier: 19 * 3 = 57

Time to write a test? 😅

Copy link
Collaborator Author

@tnull tnull Aug 17, 2023

Choose a reason for hiding this comment

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

Grrr, my bad. 🤦‍♂️
Now dropped the commit in question and replaced it with the additive approach you originally suggested.

In regard to testing: as this requires a non-trivial topology I took this as an opportunity to finally introduce a multi-hop testing scenario with #157 based on which I'll be able to check that the probe will indeed not obstruct payment sending. However, still running into some gossip issues there (as these need to be announced channels) which I'm investigating. Happy to wait until this is resolved before landing this, or landing this as is and adding testing later, your call. I'll also add unit tests when upstreaming this logic.

Copy link

Choose a reason for hiding this comment

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

I'm fine with testing upstream. Indifferent on whether you want to land this first.

@tnull tnull force-pushed the 2023-08-refuse-large-probes branch from 2f4690e to bd9f1ae Compare August 17, 2023 13:49
@tnull
Copy link
Collaborator Author

tnull commented Aug 17, 2023

Do we want to add testcases for this ?

Yes, however, see #156 (comment).

src/lib.rs Outdated Show resolved Hide resolved
Copy link

@jkczyz jkczyz left a comment

Choose a reason for hiding this comment

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

Feel free to squash.

As pre-flight probes might take up some of the available liquidity, we
here introduce that channels whose available liquidity is less than the
required amount times `Config::probing_liquidity_limit_multiplier` won't
be used to send pre-flight probes.
@tnull tnull force-pushed the 2023-08-refuse-large-probes branch from bd9f1ae to 758f91b Compare August 17, 2023 16:57
@tnull
Copy link
Collaborator Author

tnull commented Aug 17, 2023

Feel free to squash.

Squashed without further changes.

@tnull tnull merged commit a9bb2e9 into lightningdevkit:main Aug 17, 2023
3 checks passed
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.

Add heuristic to LDK Node code
5 participants