htlcswitch+invoices: tighten final-hop CLTV validation #10927
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 221 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.323
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #10927"
general
weight: 0.35
gijswijs
Change Description
This PR tightens validation of the CLTV expiry on HTLCs at the final hop and
makes the related policy bounds explicit and validated at config time.
Final-hop CLTV handling is currently permissive: an HTLC can specify a final
CLTV expiry far beyond any reasonable receive policy, and the values that bound
this behaviour aren't checked when set. Accepting an excessively large final
CLTV delta is undesirable — a single HTLC can tie up channel liquidity for a
very long time (a slow-jamming / liquidity-lockup concern), and there is no
legitimate reason for a final hop to require an expiry that far out. We already
cap CLTV deltas on the forwarding path; this brings the final hop in line and
catches misconfiguration early.
Changes
whose expiry falls outside the node's receive policy is failed back with
incorrect_or_unknown_payment_details, consistent with how other final-hoppolicy mismatches are handled and without leaking receive-side policy to the
sender. The maximum final CLTV delta is bounded and tied to the maximum
already permitted at invoice creation, so the accept and create paths agree.
values instead of silently accepting them.
lookup, so an out-of-policy final HTLC is handled consistently.
Compatibility
The CLTV policy bounds are now validated. A config value or
UpdateChannelPolicyrequest that sets an out-of-range value previously accepted silently will now be
rejected with a clear error. Nodes using sane values are unaffected.