Skip to content

Support HTLC interception by source channel - #4338

Merged
tnull merged 2 commits into
lightningdevkit:mainfrom
TheBlueMatt:2026-01-intercept-by-source-v2
Feb 18, 2026
Merged

Support HTLC interception by source channel#4338
tnull merged 2 commits into
lightningdevkit:mainfrom
TheBlueMatt:2026-01-intercept-by-source-v2

Conversation

@TheBlueMatt

@TheBlueMattTheBlueMatt commented Jan 23, 2026

Copy link
Copy Markdown
Collaborator

Just a few more flags and a small cleanup.

Based on #4300

@ldk-reviews-bot

ldk-reviews-bot commented Jan 23, 2026

Copy link
Copy Markdown

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 1st Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@tnull
tnull removed their request for review January 27, 2026 10:22

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please re-request review once #4300 lands and this is rebased.

@TheBlueMatt
TheBlueMattforce-pushed the 2026-01-intercept-by-source-v2 branch from b793c1e to 79952e1CompareJanuary 28, 2026 14:11
@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Rebased.

@TheBlueMatt
TheBlueMattforce-pushed the 2026-01-intercept-by-source-v2 branch from 79952e1 to 779fce3CompareJanuary 28, 2026 14:14

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems CI is very unhappy as this doesn't build currently.

@ldk-reviews-bot

Copy link
Copy Markdown

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@TheBlueMatt
TheBlueMattforce-pushed the 2026-01-intercept-by-source-v2 branch from 779fce3 to 0bf2200CompareJanuary 29, 2026 15:03
@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Oops, silent conflict.

@codecov

codecovBot commented Jan 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.75000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.89%. Comparing base (3497b59) to head (9a9531f).
⚠️ Report is 13 commits behind head on main.

Files with missing linesPatch %Lines
lightning/src/ln/channelmanager.rs93.75%5 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #4338 +/- ##
==========================================
- Coverage 86.09% 85.89% -0.20% 
==========================================
Files 156 156 Lines 103623 103958 +335 Branches 103623 103958 +335 ==========================================
+ Hits 89211 89299 +88 - Misses 11895 12139 +244 - Partials 2517 2520 +3 
FlagCoverage Δ
tests85.89% <93.75%> (-0.20%)⬇️

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.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 1st Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 2nd Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@elnoshelnosh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rustfmt is unhappy but code changes look good to me

Comment threadlightning/src/ln/channelmanager.rs
Comment threadlightning/src/ln/channelmanager.rs
Comment threadlightning/src/util/config.rs Outdated
Comment threadlightning/src/ln/channelmanager.rs Outdated
@ldk-reviews-bot

Copy link
Copy Markdown

🔔 3rd Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 4th Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@TheBlueMatt
TheBlueMattforce-pushed the 2026-01-intercept-by-source-v2 branch from 0bf2200 to f6ecc61CompareFebruary 7, 2026 16:51
@ldk-reviews-bot

Copy link
Copy Markdown

🔔 5th Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 6th Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@elnoshelnosh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixups lgtm

@tnulltnull left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, feel free to squash.

@TheBlueMatt
TheBlueMattforce-pushed the 2026-01-intercept-by-source-v2 branch from f6ecc61 to c4ae026CompareFebruary 12, 2026 15:16
@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Squashed without any further changes.

tnull
tnull previously approved these changes Feb 12, 2026
@ldk-reviews-bot

Copy link
Copy Markdown

✅ Added second reviewer: @tankyleo

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 1st Reminder

Hey @tankyleo! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Rebased to address conflict.

tankyleo
tankyleo previously approved these changes Feb 17, 2026
@tankyleo
tankyleo requested a review from tnullFebruary 17, 2026 22:51
We jump through some hoops in order to pass a small list of objects
to `forward_htlcs` on a per-channel basis rather than per-HTLC.
Then, `forward_htlcs` builds a `PendingAddHTLCInfo` for each HTLC
for insertion. Worse, in some `forward_htlcs` callsites we're
actually starting with a `PendingAddHTLCInfo`, converting it to a
tuple, then back inside `forward_htlcs`.
Instead, here we just pass a list of built `PendingAddHTLCInfo`s to
`forward_htlcs`, cleaning up a good bit of code and even avoiding
an allocation of the HTLCs vec in many cases.
It may be useful in some situations to select HTLCs for
interception based on the source channel in addition to the sink.
Here we add the ability to do so by adding new flags to
`HTLCInterceptionFlags`.
@TheBlueMatt

Copy link
Copy Markdown
CollaboratorAuthor

Grr, rebase broke rustfmt:

$ git diff-tree -U1 ec84d5549 9a9531f3c
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index a013b1905d..b417e023f4 100644
--- a/lightning/src/ln/channelmanager.rs+++ b/lightning/src/ln/channelmanager.rs@@ -9578,4 +9578,3 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
user_channel_id: u128, unbroadcasted_batch_funding_txid: Option<Txid>,
- update_actions: Vec<MonitorUpdateCompletionAction>,- htlc_forwards: Vec<PendingAddHTLCInfo>,+ update_actions: Vec<MonitorUpdateCompletionAction>, htlc_forwards: Vec<PendingAddHTLCInfo>,
decode_update_add_htlcs: Option<(u64, Vec<msgs::UpdateAddHTLC>)>,

@tnull
tnull merged commit d09f1d2 into lightningdevkit:mainFeb 18, 2026
16 of 17 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@TheBlueMatt@ldk-reviews-bot@tnull@elnosh@tankyleo