← Back to Pull requests

multi: tighten wire, fee and transaction invariants #11440

Closed
unknown closed this pull request without merging on Nov 10, 2026 06:24 UTC
View on GitHub
unknown unknown commented on Oct 29, 2026 22:22 UTC
Author

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 SerializeHtlcs refuses 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=1

  • go test ./chainntnfs ./chanstate ./discovery ./funding ./peer -count=1

  • go 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
  • Diff: 315 lines (+236 / -79) across 3 files Reviewer: Roasbeef Review duration: 16322m
    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
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.4% (MEDIUM) · Higher = larger blast radius
    45.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.9% · Safe to merge
    17.9%