Skip to content

Conversation

Suvrat1629
Copy link

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

📝 Please see our Contribution Guidelines for further guidance.

… state

- Enhance user-facing error when mempool fee is too low, suggesting bumpfee usage.
- Add clear error when channel is already closing, guiding users to pendingchannels and bumpfee.
Copy link

Summary of Changes

Hello @Suvrat1629, 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 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 closechannel when 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 using lncli wallet bumpfee to 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 pendingchannels for status and use lncli wallet bumpfee if 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 👍 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.

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 improves error messages in lncli closechannel to be more actionable. The changes are good, but I have a couple of suggestions. In lnwallet/btcwallet/btcwallet.go, the new error message is too specific and assumes a cooperative close, which might not always be the case. I've suggested a more generic message. In rpcserver.go, there are some indentation issues and long error strings that could be improved for readability, following the repository's style guide.

Copy link
Contributor

@NishantBansal2003 NishantBansal2003 left a comment

Choose a reason for hiding this comment

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

I was able to reproduce this part (unable to gracefully close channel...), so I think the fix makes sense. However, I think the error wording could be improved.
I was at least able to test this behaviour through itest modification (see lnd_coop_close_*). I would expect it would be good (not sure if it would be overkill) if you could also add a minimal itest for this.

Also, I have some thoughts on ErrMempoolFee, so I left my comment here: #9155 (comment)

@Suvrat1629
Copy link
Author

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.

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.

2 participants