Skip to content

Dont use PaymentPathFailed a probe fails without making it out #1704

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

@TheBlueMatt TheBlueMatt commented Sep 7, 2022

Based on #1702.

When we fail to forward a probe HTLC at all and immediately fail it
(e.g. due to the first hop channel closing) we'd previously
spuriously generate only a PaymentPathFailed event. This violates
the expected API, as users expect a ProbeFailed event instead.

This fixes the oversight by ensuring we generate the correct event.

Thanks to @jkczyz for pointing out this issue.

@TheBlueMatt TheBlueMatt marked this pull request as ready for review September 7, 2022 21:55
@TheBlueMatt TheBlueMatt added this to the 0.0.111 milestone Sep 7, 2022
wpaulino
wpaulino previously approved these changes Sep 7, 2022
tnull
tnull previously approved these changes Sep 8, 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.

Argh, good catch!

@TheBlueMatt TheBlueMatt dismissed stale reviews from tnull and wpaulino via b143b19 September 8, 2022 17:40
@TheBlueMatt TheBlueMatt force-pushed the 2022-09-always-probe-failed branch from dd591c2 to b143b19 Compare September 8, 2022 17:40
@codecov-commenter
Copy link

Codecov Report

Merging #1704 (dd591c2) into main (c57bb42) will increase coverage by 0.02%.
The diff coverage is 92.00%.

❗ Current head dd591c2 differs from pull request most recent head b143b19. Consider uploading reports for the commit b143b19 to get more accurate results

@@            Coverage Diff             @@
##             main    #1704      +/-   ##
==========================================
+ Coverage   90.93%   90.96%   +0.02%     
==========================================
  Files          86       86              
  Lines       46840    46848       +8     
  Branches    46840    46848       +8     
==========================================
+ Hits        42594    42613      +19     
+ Misses       4246     4235      -11     
Impacted Files Coverage Δ
lightning/src/util/test_utils.rs 77.49% <ø> (ø)
lightning/src/ln/functional_test_utils.rs 93.35% <66.66%> (-0.23%) ⬇️
lightning/src/ln/channelmanager.rs 86.11% <92.30%> (+0.06%) ⬆️
lightning/src/ln/payment_tests.rs 98.82% <97.22%> (-0.08%) ⬇️
lightning/src/ln/functional_tests.rs 97.06% <100.00%> (+0.14%) ⬆️
lightning/src/chain/onchaintx.rs 94.02% <0.00%> (-0.92%) ⬇️
lightning/src/util/events.rs 40.05% <0.00%> (+0.27%) ⬆️
lightning-net-tokio/src/lib.rs 77.37% <0.00%> (+0.30%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

`fail_holding_cell_htlcs` calls through to
`fail_htlc_backwards_internal` for HTLCs that need to be
failed-backwards but opts to generate its own payment failure
events for `HTLCSource:;OutboundRoute` HTLCs. There is no reason
for that as `fail_htlc_backwards_internal` will also happily
generate (now-)equivalent events for `HTLCSource::OutboundRoute`
HTLCs.

Thus, we can drop the redundant code and always call
`fail_htlc_backwards_internal` for each HTLC in
`fail_holding_cell_htlcs`.
When we fail to forward a probe HTLC at all and immediately fail it
(e.g. due to the first hop channel closing) we'd previously
spuriously generate only a `PaymentPathFailed` event. This violates
the expected API, as users expect a `ProbeFailed` event instead.

This fixes the oversight by ensuring we generate the correct event.

Thanks to @jkczyz for pointing out this issue.
@TheBlueMatt
Copy link
Collaborator Author

Squashed without further changes.

@TheBlueMatt TheBlueMatt force-pushed the 2022-09-always-probe-failed branch from b143b19 to 6601192 Compare September 8, 2022 18:55
@TheBlueMatt TheBlueMatt merged commit fa1a0d8 into lightningdevkit:main Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants