Skip to content

Conversation

@hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented Sep 8, 2025

No description provided.

@hieblmi hieblmi self-assigned this Sep 8, 2025
@hieblmi hieblmi marked this pull request as draft September 8, 2025 16:43
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.

Summary of Changes

Hello @hieblmi, 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 reliability of the static address withdrawal system. It implements crucial concurrency controls to safeguard deposit data during complex operations and introduces a new validation step to prevent potential issues when adjusting fees for existing withdrawals.

Highlights

  • Concurrency Control: Introduced explicit locking and unlocking mechanisms for deposits within the withdrawal process to ensure data consistency and prevent race conditions during state transitions.
  • Withdrawal Robustness: Added a new validation check to ensure that deposits undergoing a fee bump have a reference to their finalized withdrawal transaction, preventing issues with incomplete withdrawal records.
  • Code Clarity: Improved the clarity and grammatical correctness of several comments throughout the withdrawal manager code.
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

  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 introduces several robustness fixes for the withdrawal process in staticaddr. The main changes include adding locking to prevent race conditions when accessing deposits during a withdrawal, and adding a check to ensure a previous withdrawal transaction exists when attempting a fee bump. While the changes improve robustness, there are a few areas for improvement. The locking logic is duplicated and could be simplified for better readability. Additionally, an error is misused for the new check, and a more specific error would be clearer. There is also a minor grammatical issue in a comment.

@hieblmi hieblmi force-pushed the withdraw-fixes branch 2 times, most recently from a3e2e69 to f3854c7 Compare September 8, 2025 19:22
@hieblmi
Copy link
Collaborator Author

hieblmi commented Sep 9, 2025

/gemini review

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 introduces several robustness fixes for the withdrawal process, particularly around fee bumping. It adds new error types and checks to ensure that fee bumps are only performed on valid sets of deposits. A significant change is the refactoring of the locking mechanism for deposits within WithdrawDeposits to lock all deposits at once.

My review focuses on the correctness of this new locking strategy. I've identified a critical issue where locks are not released on several early-return paths, which could lead to deadlocks. I've also provided a minor suggestion to improve the grammar in a code comment for better clarity.

@hieblmi
Copy link
Collaborator Author

hieblmi commented Sep 9, 2025

/gemini review

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 introduces several robustness fixes for withdrawals in the staticaddr package. The most significant change is the refactoring of the locking mechanism in the WithdrawDeposits function. By acquiring a lock on all relevant deposits at the beginning of the function and carefully managing it, the new implementation effectively prevents potential race conditions and deadlocks. Additionally, a new sanity check is added to ensure that a finalized transaction is present when bumping the fee for a withdrawal, which further improves the robustness of the process. The changes are well-structured and significantly enhance the reliability of the withdrawal logic. I have one suggestion regarding code organization.

@hieblmi hieblmi marked this pull request as ready for review September 9, 2025 10:11
@hieblmi hieblmi requested review from bhandras and sputn1ck September 9, 2025 10:11
Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

lockDeposits(deposits)
locked := true
defer func() {
if locked {
Copy link
Member

Choose a reason for hiding this comment

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

nit: we could set locked = true in lockDeposits and then check if locked within unlockDeposits for a slight readability gain.

@hieblmi hieblmi merged commit ff91b51 into lightninglabs:master Sep 15, 2025
4 checks passed
@hieblmi hieblmi deleted the withdraw-fixes branch September 15, 2025 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants