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

Merge PR 'Retry a single HTLC before abandoning an unfundable batch' (#5406)

Public commit record

What the developer wrote

Authored by wpaulino

81/100 · Strong
Merge PR 'Retry a single HTLC before abandoning an unfundable batch' (#5406)

from 2026-10-htlc-batch-singleton-retry into main

Reviewed-on: https://git.rust-bitcoin.org/lightningdevkit/rust-lightning/pulls/5406
Reviewed-by: wpaulino <wpaulino@noreply.git.rust-bitcoin.org>
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This change fixes a corner case in how the Lightning node tries to claim multiple pending HTLCs (small Bitcoin payments locked in a channel) when the wallet cannot fund a single large batch transaction. Previously, if the multi-HTLC batch was too expensive to fund, the code would shrink the batch and immediately give up when only one HTLC remained, abandoning that last HTLC instead of trying to claim it alone. The patch makes the code retry the final HTLC as a single transaction before giving up, so a user is less likely to lose funds due to an unclaimable HTLC.

Recommended action

Review the change as a defensive hardening fix. Ensure the new `batch_size <= 1` guard and `saturating_sub(...).max(1)` correctly handle all batch sizes and do not introduce an infinite loop or off-by-one behavior. Consider whether the same retry-singleton logic is needed elsewhere in the bump-transaction flow.

Security signals we found

01

Funds-recovery robustness improvement: prevents premature abandonment of a single unbatched HTLC

02

Change in error-handling arithmetic from checked_sub/saturating_sub with max(1)

03

New unit tests covering both failed and successful singleton HTLC funding paths

Risk score

Why this scored 37/100

Our methodology →
Potential impact 12/30
Exploitability 5/25
Stealth signal 4/15
Affected reach 6/15
Confidence 7/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.