← Back to Pull requests

htlcswitch: validate intercepted auto-fail height #11028

Merged
ziggie1984 merged 3 files (111 lines) on Aug 06, 2026 16:16 UTC
View on GitHub
ziggie1984 ziggie1984 commented on Aug 05, 2026 22:05 UTC
Author

Change Description

This updates off-chain forward interception to validate the derived auto-fail
height before exposing it through the interceptor API. Heights outside the
supported int32 representation are returned with the BOLT-defined
expiry_too_far response.

The incoming expiry and interceptor deadline use different integer
representations. Checking the range before conversion keeps the deadline in
the supported representation while leaving in-range handling unchanged.

The accompanying test covers both out-of-range and in-range forward handling.

Steps to Test

go test ./htlcswitch \
  -run 'TestInterceptableSwitch(ExpiryTooFar|WatchDog)$' -count=1
go test -tags dev ./htlcswitch \
  -run 'TestInterceptableSwitch(ExpiryTooFar|WatchDog)$' -count=1

Pull Request Checklist

Testing

  • Your PR passes all CI checks.

  • Tests covering the positive and negative paths are included.
  • Code Style and Documentation

  • The change follows the code documentation and commenting guidelines.

  • Commits follow the ideal Git commit structure.

  • The new log statement uses the existing subsystem and debug level.
  • Diff: 111 lines (+105 / -6) across 3 files Reviewer: yyforyongyu Review duration: 1091m
    All Vouch review confidence checks passed
    Residual risk 0.09 = Change Risk (0.34) × (1 − Review Confidence (0.73)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.34 · 111 lines diff across 3 files
    0.34
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.56 · 3 substantive comment(s)
    0.56
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    72%
    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.282
    Real PR Conversation Timeline
    6 items
    github-actions[bot] github-actions[bot] commented on Aug 05, 2026 22:14 UTC
    Bot

    🔴 PR Severity: CRITICAL

    file-based classification | 3 files | 111 lines changed

    <details>
    <summary>🔴 <strong>Critical</strong> (1 file)</summary>

  • htlcswitch/interceptable_switch.go - HTLC forwarding/interception logic (auto-fail height validation for the interceptor API)
  • </details>

    <details>
    <summary>🟢 <strong>Low</strong> (2 files)</summary>

  • htlcswitch/switch_test.go - test-only change

  • docs/release-notes/release-notes-0.21.2.md - release notes
  • </details>

    Analysis

    The core change is in htlcswitch/interceptable_switch.go, which is part of the HTLC forwarding/payment routing state machine (severity-critical per package rules). The change validates the derived auto-fail height before exposing it through the interceptor API, guarding against out-of-range integer conversions. Although the diff is small (34 lines in the non-test source file) and well-covered by new tests, changes to this file touch HTLC forwarding correctness and warrant expert review of the interceptor semantics and BOLT compliance.

    ---
    <sub>To override, add a severity-override-{critical,high,medium,low} label.</sub>
    <!-- pr-severity-bot -->

    yyforyongyu yyforyongyu approved these changes on Aug 06, 2026 02:22 UTC
    Approved Reviewer

    LGTM🦺

    gijswijs gijswijs approved these changes on Aug 06, 2026 16:16 UTC
    Approved Reviewer

    LGTM! 🦺

    github-actions[bot] github-actions[bot] commented on Aug 07, 2026 02:54 UTC
    Bot

    Created backport PR for v0.20.x-branch:

  • #11038 with remaining conflicts!
  • Please cherry-pick the changes locally and resolve any conflicts.

    git fetch origin backport-11028-to-v0.20.x-branch
    git worktree add --checkout .worktree/backport-11028-to-v0.20.x-branch backport-11028-to-v0.20.x-branch
    cd .worktree/backport-11028-to-v0.20.x-branch
    git reset --hard HEAD^
    git cherry-pick -x 4ccb2aa94a6273b8d24887c1bc4c7724690a4b9a
    git push --force-with-lease
    

    github-actions[bot] github-actions[bot] commented on Aug 07, 2026 02:54 UTC
    Bot

    Successfully created backport PR for v0.21.x-branch:

  • #11039
  • Reviewers
    Assignees
    ziggie1984 ziggie1984
    Labels
    risk: low confidence: 72.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: 34.2% (LOW) · Higher = larger blast radius
    34.2%
    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: 72.5% · Lower = rushed or shallow review
    72.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: 9.4% · Safe to merge
    9.4%