Skip to content

Try to overpay the recipient if we fail to find a path at all and limit overpay #2604

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

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

Previously we'd only try to overpay if we managed to find a path
to the recipient which was sufficient. However, if we fail to find
any path to the recipient at all we should still retry overpaying
the recipient. Ultimately we should be silling to pay whatever
reasonable performance penalty if the alternative is not finding a
path at all, which we do here.

Depends on #2575.

Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

Checked that tests succeed when rebased on #2575.

@tnull tnull linked an issue Sep 27, 2023 that may be closed by this pull request
This was referenced Sep 27, 2023
@valentinewallace
Copy link
Contributor

Needs a rebase on #2575 to fix CI.

@@ -2398,6 +2398,9 @@ where L::Target: Logger {
// because we deterministically terminated the search due to low liquidity.
if !found_new_path && channel_saturation_pow_half != 0 {
channel_saturation_pow_half = 0;
} else if already_collected_value_msat < final_value_msat && path_value_msat != recommended_value_msat && !found_new_path {
log_trace!(logger, "Failed to collect enough value, but running again to collect extra paths with a potentially higher limit.");
path_value_msat = recommended_value_msat;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we only do this if we hit_minimum_limit? It doesn't hurt to go around again, but isn't hit_min_limit the only way for there to be uncollected paths remaining?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mmm, fair, yea, I can add that restriction.

@TheBlueMatt TheBlueMatt force-pushed the 2023-09-route-overpay-limit branch 3 times, most recently from 50633ed to ae9df4a Compare September 28, 2023 18:23
Copy link
Contributor

@tnull tnull 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 fixups (when rebasing).

@TheBlueMatt TheBlueMatt force-pushed the 2023-09-route-overpay-limit branch from ae9df4a to bbdf4b9 Compare September 28, 2023 18:54
@TheBlueMatt
Copy link
Collaborator Author

TheBlueMatt commented Sep 28, 2023

Squashed without change - it shouldn't need rebase as its based directly on #2575, as long as that gets merged without any change in the commits git[hub] is smart enough to ignore it.

tnull
tnull previously approved these changes Sep 28, 2023
Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter
Copy link

codecov-commenter commented Sep 28, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (082a19b) 89.00% compared to head (fa48df6) 89.04%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2604      +/-   ##
==========================================
+ Coverage   89.00%   89.04%   +0.03%     
==========================================
  Files         112      112              
  Lines       86273    86337      +64     
  Branches    86273    86337      +64     
==========================================
+ Hits        76791    76876      +85     
+ Misses       7248     7230      -18     
+ Partials     2234     2231       -3     
Files Coverage Δ
lightning/src/routing/router.rs 93.93% <98.68%> (+0.07%) ⬆️

... and 12 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TheBlueMatt TheBlueMatt dismissed tnull’s stale review September 28, 2023 20:30

The merge-base changed after approval.

@TheBlueMatt
Copy link
Collaborator Author

The merge-base changed after approval.

Lollll that's new. Sorry, have to re-ack.

tnull
tnull previously approved these changes Sep 28, 2023
@TheBlueMatt TheBlueMatt dismissed tnull’s stale review September 28, 2023 20:35

The merge-base changed after approval.

@TheBlueMatt
Copy link
Collaborator Author

Ugh wtf. Okay I'm gonna have to change ack policy wtf.

While this doesn't matter much in practice, if we go around again
when route-finding to try to meet an htlc_minimum_msat, we use the
`recommended_value_msat` which can work if we meet the
`htlc_minimum_msat` on a channel exactly, so using >= rather than >
can capture cases with 1msat more.
Previously we'd only try to overpay if we managed to find a path
to the recipient which was sufficient. However, if we fail to find
any path to the recipient at all we should still retry overpaying
the recipient. Ultimately we should be silling to pay whatever
reasonable performance penalty if the alternative is not finding a
path at all, which we do here.
If the user told us to limit their total fee exposure, we should
do so including any potential overpayment to the recipient, which
is ultimately a part of the "fee" as far as the user is concerned.
This may be useful in debugging routing failures in the future.
@TheBlueMatt TheBlueMatt force-pushed the 2023-09-route-overpay-limit branch from bbdf4b9 to fa48df6 Compare September 28, 2023 20:39
@TheBlueMatt
Copy link
Collaborator Author

Rebased without change, I think now maybe it wont drop reviews any time there's a merge.

@TheBlueMatt
Copy link
Collaborator Author

As usual, there is no setting anywhere that seems to line up with what just happened, so I guess we just have to require it be based on an upstream merge commit 🤷

@TheBlueMatt TheBlueMatt merged commit db41b87 into lightningdevkit:main Sep 29, 2023
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.

#2417 followups
4 participants