funding: enforce BOLT-02 push_msat bound on fundee#10765
funding: enforce BOLT-02 push_msat bound on fundee#10765erickcestari wants to merge 1 commit intolightningnetwork:masterfrom
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 enhances the channel funding process by enforcing the BOLT-02 requirement regarding the maximum allowed push amount. By validating this constraint early in the Highlights
🧠 New Feature in Public Preview: You can now enable Memory 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 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. Footnotes
|
PR Severity: CRITICAL -- Automated classification -- 2 files (excl. tests) -- 23 lines changed (excl. tests) -- funding/manager.go (CRITICAL: funding/) -- lnwallet/errors.go (CRITICAL: lnwallet/) -- funding/manager_test.go excluded (test file) -- No bump rules triggered -- Expert review warranted. <!-- pr-severity-bot --> |
There was a problem hiding this comment.
Code Review
This pull request enforces the BOLT-02 requirement that the push_msat value must be less than or equal to the total funding amount during channel opening. To support this, a new error ErrPushAmountTooLarge was added to the lnwallet package, and a corresponding unit test was implemented in the funding manager to ensure proper rejection of invalid requests. I have no feedback to provide as the existing comments were purely explanatory.
Reject incoming OpenChannel messages where push_msat exceeds 1000 * funding_satoshis, as required by BOLT-02. The existing RejectPush flag only gates on push_msat > 0 and does not cover the spec bound. An over-sized push is eventually caught downstream in reservation.go when theirBalance = capacity - fee - push_msat goes negative and ErrFunderBalanceDust is returned. Rejecting it up front produces a clearer, spec-aligned error and avoids the chanacceptor and commitment type negotiation round-trips for a channel we will refuse anyway.
7545f7f to
d95c1bc
Compare
Reject incoming
OpenChannelmessages where push_msat exceeds 1000 * funding_satoshis, as required by BOLT-02. The existingRejectPushflag only gates on push_msat > 0 and does not cover the spec bound.An over-sized push is eventually caught downstream in
reservation.gowhentheirBalance = capacity - fee - push_msatgoes negative andErrFunderBalanceDustis returned. Rejecting it up front produces a clearer, spec-aligned error and avoids thechanacceptorand commitment type negotiation round-trips for a channel we will refuse anyway.