Skip to content

Conversation

@valentinewallace
Copy link
Contributor

@valentinewallace valentinewallace commented Feb 9, 2026

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.

Based on #4303
Partially addresses #4286

@valentinewallace valentinewallace added this to the 0.3 milestone Feb 9, 2026
@valentinewallace valentinewallace self-assigned this Feb 9, 2026
@valentinewallace valentinewallace added the weekly goal Someone wants to land this this week label Feb 9, 2026
@ldk-reviews-bot
Copy link

👋 Hi! I see this is a draft PR.
I'll wait to assign reviewers until you mark it as ready for review.
Just convert it out of draft status when you're ready for review!

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 98.71795% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.07%. Comparing base (caf0aac) to head (94cb95d).

Files with missing lines Patch % Lines
lightning/src/ln/channelmanager.rs 97.53% 1 Missing and 1 partial ⚠️
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              
Flag Coverage Δ
tests 86.07% <98.71%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

valentinewallace and others added 6 commits February 10, 2026 13:19
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.
@valentinewallace valentinewallace force-pushed the 2026-02-dedup-htlc-fwd-data branch from 0d38512 to 94cb95d Compare February 10, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

weekly goal Someone wants to land this this week

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants