-
Notifications
You must be signed in to change notification settings - Fork 367
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
Stop sending channel_update
in onion failures
#3345
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3345 +/- ##
==========================================
- Coverage 89.67% 89.55% -0.12%
==========================================
Files 126 127 +1
Lines 103165 103469 +304
Branches 103165 103469 +304
==========================================
+ Hits 92510 92660 +150
- Misses 7935 8104 +169
+ Partials 2720 2705 -15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just skimmed the diff for now and will give it a proper look later.
Don't worry about the failing mutants CI job as the diff is triggering a bunch of existing missed mutants.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was reviewing this code during the Tokyo summit last week. Since you've already done the work, I added a couple of comments. Some might be unnecessary, and others are just to help me understand your changes 😄
let failure_code = 0x1000|7; | ||
let data = self.get_htlc_inbound_temp_fail_data(failure_code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO there was no reason to change the function return type, is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case this function failed to fetch the channel_update
, it previously indicated this to the caller by returning an 0x4000
error, and the caller would reassign the 0x1000
code with the 0x4000
code.
In case the channel_update
fetch was successful, the returned error code was the same as the one passed in.
This function no longer has this potential fetch failure, so it will never reassign the error code value to a different value. So we don't need to return an error code value any longer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I noted it, and make sense of your explaination. Probably just bias because the previous function was more "elegant" from the code point of view. Thanks for explaination
let failure_code = 0x1000|7; | ||
let data = self.get_htlc_inbound_temp_fail_data(failure_code); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👁️
Sorry I should have understood better, thank you for the review ! |
1d29256
to
66f1825
Compare
// See https://github.com/lightning/bolts/blob/341ec84/04-onion-routing.md?plain=1#L1008 | ||
0u16.write(&mut enc).expect("Writes cannot fail"); | ||
} | ||
(0u16).write(&mut enc).expect("Writes cannot fail"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it seems kind of obvious for no channel update, but could we perhaps link to https://github.com/lightning/bolts/blob/247e83d528a2a380e533e89f31918d7b0ce6a0c1/04-onion-routing.md?plain=1#L1414-L1415 in a comment?
Sorry for only seeing this now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem you are right, I think it's worth adding this reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see below, I added the link in the two places where it is relevant.
I only included the first 7 characters of the commit hash, partly to keep it consistent with the link further above in the location you pointed out.
66f1825
to
9e30f25
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn, I was hoping this would get us some nice lock cleanups, but oh well, its still fixing some bugs in phantom and removing code.
let mut fail_conditions = PaymentFailedConditions::new() | ||
.blamed_scid(phantom_scid) | ||
.expected_htlc_error_data(0x2000 | 2, &[]); | ||
.expected_htlc_error_data(0x1000 | 13, &err_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Per lightning/bolts#1173.
Fixes #3277