Skip to content

Conversation

@ffranr
Copy link
Collaborator

@ffranr ffranr commented Nov 26, 2025

Backport PR for merged commit(s): #10391
Target branch: v0.20.x-branch.

Introduce `CommitTxBlockHeight` field to the `ResolutionReq` structure
and related methods. This field records the block height where a
commitment transaction has confirmed.

(cherry picked from commit 3d2b0d7)
@ffranr ffranr self-assigned this Nov 26, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @ffranr, 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 backports a critical change to the v0.20.x-branch that introduces a CommitTxBlockHeight field to the ResolutionReq struct. This new field is essential for accurately tracking the confirmation block height of commitment transactions during various channel closing procedures, including local force closes, remote force closes, and breach retributions. By providing this explicit block height information, the system gains a more robust context for resolving channel states and HTLCs, which is crucial for the reliability and correctness of the Lightning Network's dispute resolution mechanisms.

Highlights

  • ResolutionReq Enhancement: A new field, CommitTxBlockHeight, has been added to the ResolutionReq struct in the lnwallet package. This field is designed to store the block height at which a commitment transaction confirmed, providing more explicit context for channel state resolutions.
  • Improved Force Close Context: The CommitTxBlockHeight is now passed to NewLocalForceCloseSummary and subsequently used when constructing ResolutionReq instances for various force close scenarios, including local force closes, remote force closes, and breach retributions, ensuring accurate block height information is available.
  • HTLC Resolution Updates: Functions responsible for HTLC resolutions, such as newOutgoingHtlcResolution, newIncomingHtlcResolution, and extractHtlcResolutions, have been updated to accept and utilize the new CommitTxBlockHeight parameter, enhancing the precision of contract resolution for HTLCs.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize 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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. 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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ffranr ffranr requested review from starius and ziggie1984 November 26, 2025 15:55
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly backports the addition of the CommitTxBlockHeight field to the ResolutionReq struct. This new field is then populated in all instantiations of ResolutionReq, either with a known block height or 0 if the transaction is not yet confirmed. The changes are applied consistently and correctly across all affected files, and the logic appears sound. The code formatting has also been improved in several places, enhancing readability. I have no further comments and approve of these changes.

Copy link
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

LGTM (maybe we do not need Release notes for this one here, I let others decide)

Copy link
Collaborator

@starius starius left a comment

Choose a reason for hiding this comment

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

LGTM!

I understand that this is a backport, but I wonder if it makes sense to add new unit tests or update the existing tests to make sure the field is there? We can test that before it confirms, the field's value is 0, then it holds the commitment tx confirmation height.

@yyforyongyu yyforyongyu merged commit f8b5cb0 into lightningnetwork:v0.20.x-branch Nov 27, 2025
38 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants