-
Notifications
You must be signed in to change notification settings - Fork 438
Dedup InboundUpdateAdd::Forwarded data with outer structs
#4405
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
base: main
Are you sure you want to change the base?
Dedup InboundUpdateAdd::Forwarded data with outer structs
#4405
Conversation
|
👋 Hi! I see this is a draft PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4405 +/- ##
==========================================
+ Coverage 86.05% 86.07% +0.02%
==========================================
Files 156 156
Lines 103384 103477 +93
Branches 103384 103477 +93
==========================================
+ Hits 88964 89070 +106
+ Misses 11905 11892 -13
Partials 2515 2515
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Useful when using these macros in lightning-tests/upgrade_downgrade_tests
In the next commit, we want to dedup fields between the InboundUpdateAdd::Forwarded's HTLCPreviousHopData and the outer InboundHTLCOutput/Channel structs, since many fields are duplicated in both places at the moment. As part of doing this cleanly, we first refactor the method that retrieves these InboundUpdateAdds for reconstructing the set of pending HTLCs during ChannelManager deconstruction. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously, the InboundUpdateAdd::Forwarded enum variant contained an HTLCPreviousHopData, which had a lot of fields that were redundant with the outer InboundHTLCOutput/Channel structs. Here we dedup those fields, which is important because the pending InboundUpdateAdds are persisted whenever the ChannelManager is persisted.
We need these fields to generate a correct PaymentForwarded event if we need to claim this inbound HTLC backwards after restart and it's already been claimed and removed on the outbound edge.
Previously, we were spuriously using the upstream channel's info when we should've been using the downstream channel's.
Previously, if a forwarding node reloaded mid-HTLC-forward with a preimage in the outbound edge monitor and the outbound edge channel still open, and subsequently reclaimed the inbound HTLC backwards, the PaymetForwarded event would be missing the next_user_channel_id field.
0d38512 to
94cb95d
Compare
Previously, the
InboundUpdateAdd::Forwardedenum variant contained anHTLCPreviousHopData, which had a lot of fields that were redundant with theouter
InboundHTLCOutput/Channelstructs. Here we dedup those fields, which isimportant because the pending
InboundUpdateAddsare persisted whenever theChannelManageris persisted.Based on #4303
Partially addresses #4286