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

Add missing break when scoring a path with a missing channel #1817

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

If we send payments over a path where a channel ended up being closed, we'll remove it before we call
ProbabilisticPaymentScorer::payment_path_failed. This should be fine, except that payment_path_failed does not break out of its scoring loop if a channel is missing, causing it to assign a minimum available-liquidity of the payment amount even to channels which our attempt never arrived at.

The fix is simple - add the missing check and break.

@TheBlueMatt TheBlueMatt added this to the 0.0.113 milestone Oct 31, 2022
@TheBlueMatt
Copy link
Collaborator Author

Needs a test, probably, but I'm not gonna do that right now.

@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2022

Codecov Report

Base: 90.77% // Head: 91.30% // Increases project coverage by +0.52% 🎉

Coverage data is based on head (00607a5) compared to base (6ca4994).
Patch coverage: 98.11% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1817      +/-   ##
==========================================
+ Coverage   90.77%   91.30%   +0.52%     
==========================================
  Files          87       87              
  Lines       47371    49634    +2263     
  Branches    47371    49634    +2263     
==========================================
+ Hits        43003    45317    +2314     
+ Misses       4368     4317      -51     
Impacted Files Coverage Δ
lightning/src/routing/scoring.rs 96.89% <98.11%> (+0.28%) ⬆️
lightning-net-tokio/src/lib.rs 76.73% <0.00%> (-0.31%) ⬇️
lightning/src/util/events.rs 38.40% <0.00%> (+0.26%) ⬆️
lightning/src/chain/onchaintx.rs 96.17% <0.00%> (+0.88%) ⬆️
lightning/src/ln/functional_tests.rs 98.08% <0.00%> (+1.03%) ⬆️
lightning/src/routing/gossip.rs 94.45% <0.00%> (+2.01%) ⬆️

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

tnull
tnull previously approved these changes Oct 31, 2022
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.

Makes sense. Just want to note that we'd probably want to solve this differently if we'd ever have to deal with paths in which the unannounced channels are located somewhere other than the beginning or end. I imagine this could be the case for trampoline nodes, but scoring for that probably requires rethinking a lot of things anyways.

Not sure why benchmark CI is failing, couldn't reproduce locally.

Copy link
Contributor

@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.

Needs a test, probably, but I'm not gonna do that right now.

Yeah, test is definitely needed here.

lightning/src/routing/scoring.rs Outdated Show resolved Hide resolved
@TheBlueMatt
Copy link
Collaborator Author

Just want to note that we'd probably want to solve this differently if we'd ever have to deal with paths in which the unannounced channels are located somewhere other than the beginning or end.

I'm not sure why that's the case? We don't want to break until we find the channel that caused the failure, if there's some channels in the middle that don't have a graph entry we should just ignore them. I believe that's what this change does.

lightning/src/routing/scoring.rs Outdated Show resolved Hide resolved
lightning/src/routing/scoring.rs Outdated Show resolved Hide resolved
lightning/src/routing/scoring.rs Show resolved Hide resolved
@tnull
Copy link
Contributor

tnull commented Nov 1, 2022

I'm not sure why that's the case? We don't want to break until we find the channel that caused the failure, if there's some channels in the middle that don't have a graph entry we should just ignore them. I believe that's what this change does.

I was under the impression that we'd break whenever we hit the first unknown hop on the failing path, but you're right, the hop.short_channel_id == short_channel_id check should ensure that we only stop penalizing hops after the failed one. So nevermind then.

jkczyz
jkczyz previously approved these changes Nov 2, 2022
If we send payments over a path where a channel ended up being
closed, we'll remove it before we call
`ProbabilisticPaymentScorer::payment_path_failed`. This should be
fine, except that `payment_path_failed` does not break out of its
scoring loop if a channel is missing, causing it to assign a
minimum available-liquidity of the payment amount even to channels
which our attempt never arrived at.

The fix is simple - add the missing check and break.
@TheBlueMatt
Copy link
Collaborator Author

Squashed without further changes.

@tnull tnull removed their assignment Nov 3, 2022
@TheBlueMatt TheBlueMatt merged commit d15b7cb into lightningdevkit:main Nov 3, 2022
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