-
Notifications
You must be signed in to change notification settings - Fork 2.2k
lnwire: make htlc_maximum_msat mandatory in channel_update #10173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lnwire: make htlc_maximum_msat mandatory in channel_update #10173
Conversation
This commit updates the ChannelUpdate1 message parsing to align with the updated BOLT specification where htlc_maximum_msat is now a mandatory field rather than optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @erickcestari, 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 updates the ChannelUpdate1 message parsing in the lnwire package to align with the latest BOLT specification. The primary change makes the htlc_maximum_msat field mandatory during message decoding. This ensures consistency with the updated protocol and resolves a known compatibility issue with other Lightning implementations, such as C-Lightning, which already enforce the presence of this field.
Highlights
- BOLT Specification Alignment: The ChannelUpdate1 decoding logic has been updated to reflect the latest BOLT specification, which mandates the presence of the htlc_maximum_msat field in channel_update messages.
- Mandatory htlc_maximum_msat: The htlc_maximum_msat field is now unconditionally read during the decoding of ChannelUpdate1 messages, removing the previous conditional check based on MessageFlags.
- Compatibility Fix: This modification addresses a compatibility issue where LND would accept 130-byte channel_update messages (missing htlc_maximum_msat), while C-Lightning would reject them as malformed, expecting the 138-byte message with the mandatory field.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
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 issue 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
-
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. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This PR updates ChannelUpdate1
to make htlc_maximum_msat
mandatory during decoding, which aligns with the latest BOLT specs. The change itself is correct, but as I've noted in my review comment, it's incomplete. Other parts of the file need to be updated to ensure consistency between the encoding and decoding paths, which is critical to prevent bugs.
FWIW re already reject these by default: Lines 279 to 284 in 0c2f045
|
Ooops. Closing this pr... |
Updates
ChannelUpdate1
parsing to makehtlc_maximum_msat
mandatory, aligning with the updated BOLT specification and fixing a compatibility issue with other Lightning implementations.The BOLT specification was updated to make the
htlc_maximum_msat
field mandatory inchannel_update
messages. Themust_be_one
bit inmessage_flags
that previously indicated this field's presence is now a constant value that should be ignored by receivers.During differential fuzzing between LND and C-Lightning, a compatibility issue was discovered:
channel_update
messages (missinghtlc_maximum_msat
)htlc_maximum_msat
)context: lightning/bolts#999