lnwallet: surface initial commitment key ring for N=0 force-close aux resolution#10804
lnwallet: surface initial commitment key ring for N=0 force-close aux resolution#10804GeorgeTsagk wants to merge 3 commits into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a mechanism to provide auxiliary resolvers with the initial commitment key ring for channels that are force-closed at height 0. By correctly identifying the commitment keys used before the channel_ready rotation, the changes prevent output misidentification and ensure that auxiliary components function correctly during immediate post-funding force-close events. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
🔴 PR Severity: CRITICAL
🔴 Critical (2 files)
AnalysisBoth changed files reside in the
This PR is small in scope (2 files, 61 lines), so no severity bump was triggered. However, the inherent criticality of To override, add a |
There was a problem hiding this comment.
Code Review
This pull request introduces an InitialKeyRing field to the ResolutionReq struct and implements initialCommitmentKeyRingFromState to derive the key ring for the initial commitment state at height 0. This allows downstream resolvers to correctly distinguish between initial and subsequent commitment states. The reviewer suggested minor documentation improvements to adhere to the repository's style guide, specifically regarding function comment formatting and the requirement for function documentation.
| return incomingHtlcs, outgoingHtlcs, nil | ||
| } | ||
|
|
||
| // initialCommitmentKeyRing derives the key ring for the initial commitment |
There was a problem hiding this comment.
The function comment should start with the function's name (initialCommitmentKeyRingFromState) to adhere to the repository's style guide.
| // initialCommitmentKeyRing derives the key ring for the initial commitment | |
| // initialCommitmentKeyRingFromState derives the key ring for the initial commitment |
References
- Function comments must begin with the function name. (link)
| func (lc *LightningChannel) initialCommitmentKeyRing( | ||
| whoseCommit lntypes.ChannelParty) *CommitmentKeyRing { | ||
|
|
||
| return initialCommitmentKeyRingFromState(lc.channelState, whoseCommit) | ||
| } |
There was a problem hiding this comment.
This function is missing a comment, which is required by the repository's style guide. Please add a comment that describes its purpose.
| func (lc *LightningChannel) initialCommitmentKeyRing( | |
| whoseCommit lntypes.ChannelParty) *CommitmentKeyRing { | |
| return initialCommitmentKeyRingFromState(lc.channelState, whoseCommit) | |
| } | |
| // initialCommitmentKeyRing derives the key ring for the initial commitment | |
| // state at height 0 for the channel. | |
| func (lc *LightningChannel) initialCommitmentKeyRing( | |
| whoseCommit lntypes.ChannelParty) *CommitmentKeyRing { | |
| return initialCommitmentKeyRingFromState(lc.channelState, whoseCommit) | |
| } |
References
- Every function must be commented with its purpose and assumptions. (link)
077847d to
70cfed1
Compare
70cfed1 to
94fdcc7
Compare
Description
This PR adds InitialKeyRing to lnwallet.ResolutionReq and populates it only when local commit height is 0 during force-close resolution. It gives aux resolvers the correct initial commitment key context for immediate post-funding (N=0) force closes, while leaving later commit-height force-close behavior unchanged (InitialKeyRing=nil).
At N=0, the commitment output keys are derived from the initial commitment point (pre-channel_ready rotation), so using only the live key ring can misidentify outputs and break the aux components.