invoices: revalidate accepted htlc expiries at set completion #11551
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.37) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 233 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.326
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #11551"
general
weight: 0.35
litbot-9000
Change Description
Revalidate the expiry of every accepted HTLC in an MPP or AMP set at the
moment the set becomes complete.
Each shard's expiry is checked against the final CLTV requirements when it is
first accepted. While the set waits for its remaining shards, the chain
advances, so an earlier shard may no longer satisfy those requirements by the
time the final shard arrives. Previously, only the arriving shard was checked
at that point.
When an incoming HTLC would complete a set,
updateMppnow also checks everypreviously accepted HTLC in that set against both the registry's final CLTV
reject delta and the invoice's final CLTV delta at the current height. If any
of them no longer qualifies, the accepted HTLCs of that set are canceled, the
completing HTLC is failed with the new set-level
ResultHtlcSetExpiryTooSoon, and the invoice remains open so the payer canretry.
For AMP invoices only the set identified by the incoming set ID is evaluated;
other sets on a reusable AMP invoice are unaffected. The existing
set-cancellation logic used for AMP reconstruction failures is factored into a
shared helper.
SubscribeHtlcEventsmaps the new result to the existingINVOICE_EXPIRY_TOO_SOONfailure detail.Steps to Test
All pass locally on this branch.
Pull Request Checklist
Testing
Code Style and Documentation
lnclicommand is introduced.# Bug Fixes.