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

contractcourt: align final htlc handling in contest resolver

Public commit record

What the developer wrote

Authored by ziggie

73/100 · Adequate
contractcourt: align final htlc handling in contest resolver

Mirror the link's final-hop HTLC checks in the incoming contest resolver so
the off-chain link path and on-chain resolver use the same final-hop handling.

Use MaxFinalCltvDelta directly in contractcourt to match invoice creation and
link processing.

Preserve the link's custom HTLC behavior by leaving amount checks to auxiliary
traffic shapers when custom HTLC handling applies.
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This change fixes a mismatch between how Lightning Network payment checks are done while a payment is still flowing through the network versus when the channel is forced on-chain. Previously, the on-chain resolver could settle an exit-hop HTLC even if its amount or expiry did not match the invoice's final-hop rules, because it only checked the preimage. Now the on-chain resolver applies the same final-hop validation as the regular link path, and refuses to settle invalid final HTLCs. A special hook is preserved for custom/auxiliary HTLCs so they can still use their own amount validation.

Recommended action

Treat this as a security-hardening fix and include it in the next maintenance release. Review whether any production nodes have settled on-chain HTLCs that would now be classified invalid, and consider whether a CVE or security advisory is warranted if the prior behavior allowed loss of funds or invoice bypass. No immediate emergency action is indicated by the diff alone.

Security signals we found

01

On-chain resolver now rejects final-hop HTLCs with mismatched amount or expiry, preventing settlement of non-conforming HTLCs that previously could be settled with only a preimage

02

Aligns on-chain and off-chain final-hop handling, reducing a class of inconsistency bugs

03

Custom HTLC amount validation remains delegated to auxiliary channel logic, preserving existing extension behavior

Risk score

Why this scored 59/100

Our methodology →
Potential impact 18/30
Exploitability 12/25
Stealth signal 8/15
Affected reach 10/15
Confidence 7/10
Evidence quality 4/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.