multi: tighten wire, fee and transaction invariants #11440
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 315 lines diff across 3 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.344
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #11440"
general
weight: 0.35
Roasbeef
In this PR, we tighten several correctness edges across wire message handling, fee selection, transactional storage, channel state persistence, gossip validation, channel negotiation, and cooperative close negotiation. Valid inputs continue through the existing paths, while malformed or inconclusive inputs now retain enough context for the caller to make the right retry or failure decision.
The wire changes bound watchtower decoders to the bytes left in each message frame, and the watchtower policy applies dust thresholds to the matching output scripts. The sweep changes keep fee curves within their transaction budget (logging a warning when a requested starting rate has to be replaced), and retry inconclusive notifier reads without misclassifying inputs. An inconclusive spend check during record processing no longer holds back a fee bump.
We also retain the first etcd read error from interfaces that can't return one directly, preventing a later write from committing after an inconclusive read. Cooperative close negotiation carries the selected signature variant into transaction construction, so the closee builds the same one-output transaction when the closer omits its own non-dust output.
On the channel side, aux signatures are only attached to HTLCs on taproot overlay channels, matching the existing overlay-only count check, and
SerializeHtlcsrefuses to write HTLC data larger than the reader accepts, so a persisted HTLC can always be read back. Constraint verification now rejects a zero CSV delay for every channel type, in both funding roles. The gossiper no longer marks a short channel ID as a zombie when an announcement's keys fail to reconstruct the funding script, since that only proves the announcement itself is invalid. Finally, the chain notifier logs a spend without witness data as an error rather than at the critical level that shuts the daemon down, and a few per-request dispatch messages move to trace.See each commit message for a detailed description w.r.t the incremental changes.
Testing
go test ./watchtower/wtwire ./watchtower/wtserver ./watchtower/wtpolicy ./sweep ./lnwallet/chancloser ./lnwallet -count=1 -parallel=1go test ./chainntnfs ./chanstate ./discovery ./funding ./peer -count=1go test ./watchtower/wtclient -run '^TestClient/send_and_recv$' -count=3 -parallel=1(cd kvdb && go test -tags=kvdb_etcd ./etcd -count=1)(cd tlv && go test ./... -count=1)GOWORK=off ./tools/custom-gcl run -v --new-from-rev=origin/master