- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.2k
BOLT11 invoice follows the new spec changes #10326
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
base: master
Are you sure you want to change the base?
Conversation
Decode function now fail the payment if mandatory field (`p`, `h`, `s`, `n`) does not have the correct length (52, 52, 52, 53). Enforced payment secret field and correct lenght in the validateInvoice function.
| Summary of ChangesHello @MPins, 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 significantly enhances the robustness and compliance of BOLT 11 invoice handling by integrating the latest specification updates. The primary focus is on enforcing strict validation for critical invoice fields, ensuring that payment hashes, payment secrets, and destination public keys meet their specified length requirements. This change prevents the processing of malformed invoices, improving overall network reliability and security. Highlights
 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 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 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
 | 
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 pull request correctly updates the BOLT 11 invoice implementation to align with recent specification changes, enforcing mandatory field length validation for p, h, s, and n fields. Instead of skipping fields with incorrect lengths, the invoice decoding now fails, which improves spec compliance. The changes are well-implemented, with improved error handling in zpay32/decode.go and a new validation check for payment secrets in zpay32/invoice.go. All related tests have been diligently updated to reflect these new, stricter validation rules. The code is clean, adheres to the style guide, and the release notes are clear. Overall, this is a solid contribution.
Adpat the current tests to the new behavior of 'Decode', 'validateInvoice', 'parseTaggedFields', 'parse32Bytes' and 'parseDestination'.
Fixes #9700
Fixes #9842
This PR updates the BOLT 11 invoice implementation to follow the new specification changes.
Specifically, it enforces validation of mandatory fields (p, h, s, n) and their expected lengths (52, 52, 52, 53 respectively).