-
Notifications
You must be signed in to change notification settings - Fork 912
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
Expose htlc id to htlc_accepted
hook
#5303
Conversation
Not quite sure what the use here would be, as |
If one is implementing a bridge between two networks they must be able to relay multiple HTLCs with the same payment hash, and because of that they should be able to know which one to fail/fulfill based on the id, not the payment hash. Or I could have misunderstood everything. |
I think you can track them yourself: each HTLC is a hook call. In the hook handler you can assign any unused partid for the HTLC you insert into the other node, it doesn't have to match the one in the incoming part at all. You then wait or poll with the partid you chose and then relay the result by returning from the hook handler. Also come to think of it the HTLC id and the partid are inherently different concepts, one is a monotonic increasing counter for HTLCs on that channel and the other is a differentiator for the sender to know which part it is tracking in the context of a payment. Notice also that if you happen to forward HTLCs from two different incoming channels you may end up with HTLC id collisions which would be hard to debug. |
But I don't get the Imagine I get two
Yes, but I can easily track them by |
Oh, I see this is related to being able to distinguish them and associate them with downstream effects, without having to differentiate them by amount which may also have a collision. Very good catch, I didn't see this :-) Sounds good to me ^^ Do you mind adding a tiny ACK b3bb188 |
OK, done! |
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.
ACK 94522c5
Changelog-Added: Plugins: `htlc_accepted` now exposes the `short_channel_id` for the channel from which that HTLC is coming from and the low-level per-channel HTLC `id`, which are necessary for bridging two different Lightning Networks when MPP is involved.
OK, I've also added the incoming |
Good catch! Ack 5404c20 |
I believe this is necessary for low-level stuff that deals with MPP, for example, although I am not entirely sure.