[v0.21.x-branch] Backport #11482: lnwallet: reject oversized unsigned acked update logs #11511
All Vouch review confidence checks passed
Residual risk 0.13 = Change Risk (0.33) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.33 · 154 lines diff across 1 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.302
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #11511"
general
weight: 0.35
ziggie1984
Backport of #11482
Backport note:
chanstatedoes not exist on this branch, so the serializer guard and the wrapped-count recovery live inchanneldb/channel.go. The bucket-level decoder takes a*bytes.Readerfor the trailing-data check, and the decoder used inside commit diffs keeps reading from a stream. The tests moved intochanneldbaccordingly.---
Summary
The unsigned acked remote update list is stored with a
uint16count. At 65,536 entries, the count wraps to zero while the serializer still writes every entry. A restart then loads an empty list and can omit a previously settled HTLC from the reconstructed commitment state.In this PR, we reject an oversized list before advancing the local commitment tail or returning a revocation. The serializer also rejects oversized lists before writing bytes. For records written by older nodes, the database reader recovers a complete trailing list only when its length matches the wrapped count; malformed trailing data is rejected.
Validation
go test ./chanstate ./channeldb ./lnwallet -count=1go vet ./chanstate ./channeldb ./lnwalletgo test ./contractcourt ./htlcswitch -run '^$'git diff --checkThis PR is a draft pending hosted CI.