-
Notifications
You must be signed in to change notification settings - Fork 384
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 a reason to HTLCHandlingFailed event #3601
base: main
Are you sure you want to change the base?
Conversation
/// The HTLC was failed by the local node. | ||
Local { | ||
/// The BOLT 04 failure code providing a specific failure reason. | ||
failure_code: u16 |
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 admit I'm not super excited about exposing the failure code as-is for two reasons - (a) we have very different constraints on the code - we may not always want to give the sender all the details about a failure (eg if the sender used a private channel but we didn't mean to expose it we might pretend the channel doesnt exist) vs what we want to tell the user about a failure (basically everything), (b) its not particularly easy to parse - users have to go read the BOLT then map that to what is actually happening in LDK code, if we had a big enum here we'd be able to provide good docs linking to config knobs and reasons why failures happened.
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.
Makes sense, will take a look at adding a more detailed enum or adding to HTLCDestination
👍
@@ -1441,6 +1461,10 @@ pub enum Event { | |||
prev_channel_id: ChannelId, | |||
/// Destination of the HTLC that failed to be processed. | |||
failed_next_destination: HTLCDestination, | |||
/// The cause of the processing failure. |
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.
Its worth noting that HTLCDestination
has some "reason"-like attributes (I meant to mention this in the issue, but apparently forgot), they're just incomplete and too broad. Up to you if you want to try to add more details there vs adding a new enum.
I'm going to be out on vacation until 3 March, but will pick this up when I get back! |
This PR adds a
HTLCHandlingFailure
reason toHTLCHandlingFailed
to fix #3541.A simpler version of this would be to make
HTLCFailReason
public and just surface that on the API. Decided against this approach because it exposes not-so-user-friendly types on the API with types likeOnionErrorPacket
, but happy to go with that way if it's preferred!