Note that we may want to apply HTLC deletes to the upcoming set of HTLCs
What changed, and why it matters
This commit only adds a code comment suggesting a future improvement. It does not change any actual behavior. The comment notes that when processing pending HTLC additions, pending HTLC removals should probably also be processed at the same time to make better use of channel funds. There is no fix or active vulnerability present in this change.
No immediate action required. Treat as a non-security code-comment commit. If investigating this area, review whether the noted TODO could lead to suboptimal liquidity usage or inconsistent commitment construction, but this commit itself does not introduce or fix a vulnerability.
Security signals we found
No functional code change
Comment-only TODO about HTLC removal handling
No explicit security claim by vendor
Evidence from the diff
The diff adds a TODO comment in channel.rs near the logic that gathers HTLC additions from the holding cell when building the next commitment. The comment observes that HTLC removals are released from the holding cell alongside additions, so removals should also be considered in the upcoming HTLC set. No code logic is modified.
Changed components
lightning/src/ln/channel.rsInspect captured patch +3 / −0
diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs
index d30089f..3c7a825 100644
--- a/lightning/src/ln/channel.rs
+++ b/lightning/src/ln/channel.rs
@@ -4405,6 +4405,9 @@ where
amount_msat,
});
+ // TODO: HTLC removals are released from the holding cell at the same time
+ // as HTLC additions, so if HTLC additions are applied here, so should HTLC removals.
+ // This would allow us to make better use of channel liquidity.
let holding_cell_htlcs = self.holding_cell_htlc_updates.iter().filter_map(|htlc| {
if let &HTLCUpdateAwaitingACK::AddHTLC { amount_msat, .. } = htlc {
Some(HTLCAmountDirection { outbound: true, amount_msat })
Why this scored 11/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.