Skip to content

contractcourt: retain deadline across contest resolution - #11032

Merged
ziggie1984 merged 2 commits into
lightningnetwork:masterfrom
ziggie1984:contractcourt-forward-contest-deadline
Aug 6, 2026
Merged

contractcourt: retain deadline across contest resolution#11032
ziggie1984 merged 2 commits into
lightningnetwork:masterfrom
ziggie1984:contractcourt-forward-contest-deadline

Conversation

@ziggie1984

Copy link
Copy Markdown
Collaborator

Change Description

Outgoing contest resolvers embed the timeout resolver they transition to once
the outgoing HTLC reaches its expiry. Forward the corresponding incoming HTLC
expiry to that embedded resolver so the existing deadline remains available
after the transition.

The added test exercises the contest-to-timeout transition and checks that the
supplied deadline is retained.

Steps to Test

go test ./contractcourt \
  -run 'TestHtlcOutgoingResolver(SupplementDeadline|Timeout|RemoteClaim)$' \
  -count=1

Pull Request Checklist

Testing

  • Your PR passes all CI checks.
  • Tests covering the changed behavior are included.

Code Style and Documentation

  • The change follows the code documentation and line-length guidelines.
  • Commits follow the ideal Git commit structure.
  • A change description is included in the 0.21.2 release notes.

@github-actions github-actions Bot added the severity-critical Requires expert review - security/consensus critical label Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

🔴 PR Severity: CRITICAL

gh pr view | 3 files | 47 lines changed

🔴 Critical (1 file)
  • contractcourt/htlc_outgoing_contest_resolver.go - on-chain HTLC dispute/breach resolution logic (contractcourt/*)
🟢 Low (2 files)
  • contractcourt/htlc_outgoing_contest_resolver_test.go - test-only change
  • docs/release-notes/release-notes-0.21.2.md - release notes

Analysis

This PR modifies contractcourt/htlc_outgoing_contest_resolver.go, which is part of the on-chain contract dispute/breach resolution code path (contractcourt/*). Per policy, any change to this package is classified CRITICAL regardless of size, since bugs here can affect fund safety during channel breaches. The change itself is small (6 lines added/2 removed in the non-test file, plus accompanying tests and release notes), so no severity bump was needed beyond the base CRITICAL classification — but the change still warrants expert review given the sensitivity of this code path.


To override, add a severity-override-{critical,high,medium,low} label.

Forward the supplied incoming HTLC expiry from the outgoing contest resolver to its embedded timeout resolver. This keeps the deadline available when resolution transitions after the outgoing HTLC expires.
@ziggie1984
ziggie1984 force-pushed the contractcourt-forward-contest-deadline branch from adcde6c to 5b4c506 Compare August 6, 2026 02:38
@ziggie1984 ziggie1984 added this to v0.21 Aug 6, 2026
@ziggie1984 ziggie1984 added this to the v0.21.2 milestone Aug 6, 2026
@ziggie1984 ziggie1984 self-assigned this Aug 6, 2026
@ziggie1984 ziggie1984 added backport-v0.20.x-branch This label is used to trigger the creation of a backport PR to the branch `v0.20.x-branch`. backport-v0.21.x-branch This label triggers a backport to branch `v0.21.x-branch ` labels Aug 6, 2026

@Roasbeef Roasbeef left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🌞

@ziggie1984 ziggie1984 moved this to In progress in v0.21 Aug 6, 2026
@saubyk saubyk moved this from In progress to In review in v0.21 Aug 6, 2026

@yyforyongyu yyforyongyu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@ziggie1984
ziggie1984 merged commit 18f930a into lightningnetwork:master Aug 6, 2026
43 of 46 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in v0.21 Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

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

Please cherry-pick the changes locally and resolve any conflicts.

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

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

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

ziggie1984 added a commit that referenced this pull request Aug 6, 2026
…21.x-branch

[v0.21.x-branch] Backport #11032: contractcourt: retain deadline across contest resolution
ziggie1984 added a commit that referenced this pull request Aug 6, 2026
…20.x-branch

[v0.20.x-branch] Backport #11032: contractcourt: retain deadline across contest resolution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v0.20.x-branch This label is used to trigger the creation of a backport PR to the branch `v0.20.x-branch`. backport-v0.21.x-branch This label triggers a backport to branch `v0.21.x-branch ` severity-critical Requires expert review - security/consensus critical

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants