Skip to content

lnwallet+lnwire: handle boundary cases - #11035

Open
yyforyongyu wants to merge 3 commits into
lightningnetwork:masterfrom
yyforyongyu:fix-p2p-wedges
Open

lnwallet+lnwire: handle boundary cases#11035
yyforyongyu wants to merge 3 commits into
lightningnetwork:masterfrom
yyforyongyu:fix-p2p-wedges

Conversation

@yyforyongyu

Copy link
Copy Markdown
Member

Change Description

Make channel funding completion return both results when its pending wallet
reservation is no longer present. Define the last block height for zero-length
query and reply channel ranges while preserving existing non-empty and
overflow behavior.

Add focused regression coverage and a v0.21.3 release note.

Steps to Test

  • go test ./lnwallet ./lnwire -count=1
  • go test -race ./lnwallet -run TestHandleFundingCounterPartySigsMissingReservation -count=1
  • go test -race ./lnwire -run TestChannelRangeLastBlockHeight -count=1

Pull Request Checklist

Testing

  • Your PR passes all CI checks.
  • Tests covering the positive and negative (error paths) are included.
  • Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

  • The change is not insubstantial.
  • The change obeys the code documentation and commenting guidelines, and lines wrap at 80.
  • Commits follow the ideal Git commit structure.
  • No new logging statements are introduced.
  • No new lncli commands are introduced.
  • There is a change description in the release notes.

Please see the contribution guidelines for further guidance.

Return both completion results when the reservation is no longer
present.

Add a focused regression test for the missing-reservation response.
Define LastBlockHeight for zero-length query and reply ranges.
Return the first block height when the range is empty.

Cover empty, normal, and overflowing ranges for both message types.
@yyforyongyu yyforyongyu added this to the v0.21.3 milestone Aug 6, 2026
@yyforyongyu yyforyongyu added the backport-v0.21.x-branch This label triggers a backport to branch `v0.21.x-branch ` label Aug 6, 2026
Document the channel funding and channel range boundary fixes for the
v0.21.3 maintenance release.
@saubyk saubyk added this to v0.21 Aug 6, 2026
@saubyk saubyk moved this to In progress in v0.21 Aug 6, 2026
@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 | 6 files | 169 lines changed

🔴 Critical (3 files)
  • lnwallet/wallet.go - wallet operations / channel funding logic
  • lnwire/query_channel_range.go - Lightning wire protocol message
  • lnwire/reply_channel_range.go - Lightning wire protocol message
🟢 Low (3 files)
  • docs/release-notes/release-notes-0.21.3.md - release notes only
  • lnwallet/wallet_test.go - test-only change
  • lnwire/reply_channel_range_test.go - test-only change

Analysis

This PR touches both lnwallet/* (wallet operations) and lnwire/* (wire protocol message encoding/decoding for channel range queries), both of which are CRITICAL-tier packages. The core change is small (1 line in wallet.go, ~8 lines across the two lnwire files) and is accompanied by good test coverage, but changes to wire message encoding and wallet logic warrant expert review given their correctness sensitivity and potential for peer-interop or fund-safety impact.


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

@yyforyongyu
yyforyongyu marked this pull request as ready for review August 7, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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: In progress

Development

Successfully merging this pull request may close these issues.

2 participants