Improve lncli closechannel error messages for mempool fee and channel state (#9155)
Change Description
This PR addresses issue #9155 by making error messages for lncli closechannel more actionable and less confusing:
- When the mempool minimum fee is not met, the error now explains that a cooperative close transaction was created but not accepted, and suggests using lncli wallet bumpfee.
- If a channel is already in the process of closing, the error now clearly states this and guides users to check lncli pendingchannels and use bumpfee if needed. All error strings follow Go style guidelines.
Steps to Test
- Attempt to close a channel with a low fee and verify the new error message suggests bumpfee.
- Try to close a channel that is already closing and confirm the error directs you to pendingchannels and bumpfee.
Pull Request Checklist
Testing
- [ ] Your PR passes all CI checks.
- [ ] Tests covering the positive and negative (error paths) are included.
- [ ] Bug fixes contain tests triggering the bug to prevent regressions.
Code Style and Documentation
- [ ] The change is not insubstantial. Typo fixes are not accepted to fight bot spam.
- [ ] The change obeys the Code Documentation and Commenting guidelines, and lines wrap at 80.
- [ ] Commits follow the Ideal Git Commit Structure.
- [ ] Any new logging statements use an appropriate subsystem and logging level.
- [ ] Any new lncli commands have appropriate tags in the comments for the rpc in the proto file.
- [ ] There is a change description in the release notes, or
[skip ci]in the commit message for small changes.
📝 Please see our Contribution Guidelines for further guidance.
Summary of Changes
Hello @Suvrat1629, I'm Gemini Code Assist[^1]! 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 user experience for lncli closechannel by providing more actionable and less confusing error messages. It addresses common scenarios where channel closure fails due to insufficient transaction fees or when a channel is already in a closing state, guiding users with clear instructions on how to proceed and resolve these issues.
Highlights
- Improved Mempool Fee Error Message: The error message for
lncli closechannelwhen the mempool minimum fee is not met now explicitly states that the cooperative close transaction was created but not accepted due to low fees, and suggests usinglncli wallet bumpfeeto resolve the issue. - Enhanced Channel Closing State Error: If a channel is already in the process of closing, the error message now clearly informs the user of this state and guides them to check
lncli pendingchannelsfor status and uselncli wallet bumpfeeif the transaction is unconfirmed.
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 :thumbsup: and :thumbsdown: 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.
[^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.
However, I think the error wording could be improved.
Any suggestions on how to improve this? I tried to keep the message as direct as possible based on my understanding.
I would expect it would be good (not sure if it would be overkill) if you could also add a minimal itest for this.
I will add a test once you approve my changes. I think I need to add tests in rpcserver_test.go and btcwallet_test.go I presume? Could you please confirm.
Also, I have some thoughts on
ErrMempoolFee, so I left my comment here: #9155 (comment)
Yes I did take a look at the comment and I am still learning about the codebase so I took a look at lnd/lnwallet/interface.go I think this is the base error and handles generic error messages, my change in the this pr handles the specific case mentioned in the issue.
@nishantbansal2003: review reminder @suvrat1629, remember to re-request review from reviewers when ready