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

Fix PaymentPathFailed::payment_failed_permanently on blinded path fail #2576

Conversation

valentinewallace
Copy link
Contributor

@valentinewallace valentinewallace commented Sep 14, 2023

Previously this value would be incorrectly set to true because we wouldn't
account for blinded hops when determining if we were processing the last hop's
failure packet.

This is tested in the follow-up. I'm not ready to update that PR yet because I'm still reworking the commit history, but I have a WIP branch if anyone wants to verify the test coverage.

Includes a few minor cleanups of onion_utils::process_onion_failure and friends.

Also closes #2532.

@valentinewallace valentinewallace added this to the 0.0.117 milestone Sep 14, 2023
@TheBlueMatt
Copy link
Collaborator

Since you're touching this code, can you also fix #2532?

@valentinewallace valentinewallace force-pushed the 2023-09-fix-outbound-bp-fail-ev branch from 9bde6f2 to db052de Compare September 15, 2023 21:01
@valentinewallace
Copy link
Contributor Author

Added a commit addressing #2532 and rebased in hopes of fixing CI.

@valentinewallace valentinewallace force-pushed the 2023-09-fix-outbound-bp-fail-ev branch from db052de to 697150c Compare September 15, 2023 21:02
@codecov-commenter
Copy link

codecov-commenter commented Sep 15, 2023

Codecov Report

Patch coverage: 82.53% and project coverage change: -1.82% ⚠️

Comparison is base (89fb5a3) 90.63% compared to head (6299f7d) 88.81%.
Report is 52 commits behind head on main.

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2576      +/-   ##
==========================================
- Coverage   90.63%   88.81%   -1.82%     
==========================================
  Files         113      113              
  Lines       59054    84461   +25407     
  Branches    59054    84461   +25407     
==========================================
+ Hits        53522    75013   +21491     
- Misses       5532     7243    +1711     
- Partials        0     2205    +2205     
Files Changed Coverage Δ
lightning/src/ln/onion_utils.rs 91.49% <65.51%> (+0.52%) ⬆️
lightning/src/ln/onion_route_tests.rs 97.56% <96.42%> (-0.68%) ⬇️
lightning/src/ln/outbound_payment.rs 88.80% <100.00%> (-2.00%) ⬇️

... and 110 files with indirect coverage changes

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

lightning/src/ln/onion_utils.rs Outdated Show resolved Hide resolved
network_update = Some(NetworkUpdate::ChannelFailure {
short_channel_id: route_hop.short_channel_id,
short_channel_id: failing_route_hop.short_channel_id,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should remove the network update entirely. Even with perm set to false this will still mark the channel disabled even though it isn't.

Copy link
Contributor Author

@valentinewallace valentinewallace Sep 20, 2023

Choose a reason for hiding this comment

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

We only mark the channel as disabled if is_permanent is set. It's nice to set it because then we can more easily keep the behavior of defaulting to NetworkUpdate::NodeFailure on a totally bogus channel update.

@valentinewallace valentinewallace force-pushed the 2023-09-fix-outbound-bp-fail-ev branch from 697150c to 9e2f95e Compare September 20, 2023 19:12
lightning/src/ln/onion_utils.rs Outdated Show resolved Hide resolved
lightning/src/ln/onion_utils.rs Outdated Show resolved Hide resolved
@valentinewallace valentinewallace force-pushed the 2023-09-fix-outbound-bp-fail-ev branch 2 times, most recently from 1bdc2af to 0c62e8c Compare September 21, 2023 15:08
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.

LGTM. Feel free to squash.

This variable is ultimately for setting
PaymentPathFailed::payment_failed_permanently, so use this name rather than
flipping a bool back and forth.
Our ultimate goal with this field is to set
PaymentPathFailed::payment_failed_permanently, so use this name rather than
flipping a bool back and forth across methods.
We don't support sending to paths where we are the intro node yet, but may as
well set the failure correctly now.
Previously this value would be incorrectly set to true because we wouldn't
account for blinded hops when determining if we were processing the last hop's
failure packet.
We've run into this several times in the wild, likely due to
ElementsProject/lightning#6200 wherein a node on the
path will error with 0x1000 but not provide a channel update (a spec
violation).

Previously, we would blame the inbound edge even though the buggy peer wanted
us to blame the outbound edge. Since this issue seems to be recurring and our
blaming the inbound edge is causing us to punish innocent channels, trust the
peer that the outbound edge is the one to blame.
@valentinewallace valentinewallace force-pushed the 2023-09-fix-outbound-bp-fail-ev branch from 0c62e8c to 6299f7d Compare September 22, 2023 19:57
@TheBlueMatt TheBlueMatt merged commit 0e83e91 into lightningdevkit:main Sep 25, 2023
14 of 15 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.

Handle temporary_channel_failure missing update better
4 participants