AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 35 Bitcoin

Move HTLC holding into HTLC decode from `forward_htlcs`

Public commit record

What the developer wrote

Authored by Matt Corallo

85/100 · Strong
Move HTLC holding into HTLC decode from `forward_htlcs`

When we added support for async payments (which requires holding
HTLCs until we receive an onion message), we added the hold logic
to `ChannelManager::forward_htlcs`. This made sense as we reused
the forwarding datastructure in the holding logic so already had
the right types in place, but it turns out only a single call of
`forward_htlcs` should ever result in an HTLC being held.

All of the other calls (un-holding an HTLC, forwarding an
intercepted HTLC, forwarding an HTLC decoded by LDK prior to 0.2,
or processing a phantom receive) should never result in an HTLC
being held. Instead, HTLCs should actually only ever be held when
the HTLC is decoded in `process_pending_update_add_htlcs` before
forwarding.

Because of this, and because we want to move the interception (and
thus also the holding logic) out of `forward_htlcs`, here we move
the holding logic into `process_pending_update_add_htlcs`.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit is a code cleanup that moves where in the program Lightning payments are intentionally held (paused) for async delivery. It does not add or remove security behavior, but it changes which internal function is responsible for deciding to hold a payment. Because the change is described as a prerequisite for moving interception logic out of a central forwarding function, it could affect correctness of payment handling if done wrong, but the diff itself appears to preserve the same hold logic in a different location.

Recommended action

Treat as a normal refactor review. Verify that the moved hold logic is reached exactly once per HTLC and that no other call paths into forward_htlcs still expect to evaluate should_hold_htlc(). Confirm the duplicate intercept_id failure path remains reachable and that lock ordering of pending_intercepted_htlcs is unchanged relative to other locks held in process_pending_update_add_htlcs.

Security signals we found

01

Logic relocation of HTLC hold/intercept decision point

02

Duplicate intercept_id now handled at decode time with debug_assert and failure fallback

03

No new cryptographic, network, or permission checks introduced

04

Commit message frames change as enabling future interception refactoring

Risk score

Why this scored 35/100

Our methodology →
Potential impact 8/30
Exploitability 5/25
Stealth signal 6/15
Affected reach 7/15
Confidence 6/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.