Skip to content

Conversation

@hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented Jan 9, 2026

Update static address loop-in client to support dynamic server-side confirmation requirements.

Changes:

  • Reduce MinConfs from 6 to 1 to allow faster swap attempts for small amounts while the server enforces risk-based confirmation requirements
  • Update SelectDeposits to prioritize more-confirmed deposits first, increasing the likelihood of server acceptance when dynamic requirements apply
  • Add client-side logging of insufficient confirmation details from server errors, helping users understand when deposits need more confirmations before retrying

Proto updates:

  • Add DepositConfirmationStatus message with current/required confirmations and blocks to wait
  • Add InsufficientConfirmationsDetails message for structured error responses

Backwards compatible: Clients with older servers will continue to work normally. The server determines actual confirmation requirements.

@gemini-code-assist
Copy link

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 updates the static address loop-in client to dynamically adapt to server-side confirmation requirements. It streamlines the process for small swaps by reducing the client's minimum confirmation threshold, intelligently prioritizes deposits based on their confirmation status, and provides clearer feedback to users when deposits require additional confirmations. These changes improve the client's efficiency and user experience when interacting with servers that implement risk-based confirmation policies.

Highlights

  • Reduced Minimum Confirmations: The client's MinConfs constant has been lowered from 6 to 1. This change allows for faster swap attempts, particularly for smaller amounts, by relying on the server's dynamic, risk-based confirmation requirements.
  • Optimized Deposit Selection Logic: The SelectDeposits function now prioritizes deposits based on a new sorting order: first by the number of confirmations (more confirmed deposits are preferred), then by larger amounts, and finally by those expiring sooner. This increases the likelihood of server acceptance when dynamic confirmation rules are in effect.
  • Enhanced Client-Side Error Logging: New client-side logging has been implemented to provide detailed information when a server returns an 'insufficient confirmations' error. This helps users understand precisely why a deposit might need more confirmations before a retry.
  • New Protocol Buffer Messages: Two new protobuf messages, DepositConfirmationStatus and InsufficientConfirmationsDetails, have been introduced. These messages provide a structured way for the server to communicate detailed confirmation requirements and statuses to the client.

🧠 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 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.

@hieblmi hieblmi changed the title Dyn deposit confs staticaddr: dynamic deposit conf target matching legacy loop-in Jan 9, 2026
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 support for dynamic server-side confirmation requirements for static address loop-ins. The client's minimum confirmation requirement is lowered to 1, and the deposit selection logic is updated to prioritize deposits with more confirmations. Additionally, the client now logs detailed information when a swap fails due to insufficient confirmations, improving user feedback. The changes look good and align with the goal of providing more flexibility for loop-in swaps. I've added a couple of minor suggestions to improve log message formatting for better readability.

Comment on lines +933 to +934
log.Warnf("Insufficient deposit confirmations, max wait: "+
"%d blocks", confDetails.MaxBlocksToWait)

Choose a reason for hiding this comment

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

medium

For better readability and to avoid string concatenation, you can include the full format string directly in log.Warnf.

log.Warnf("Insufficient deposit confirmations, max wait: %d blocks", confDetails.MaxBlocksToWait)

Comment on lines +937 to +940
log.Warnf(" Deposit %s: %d/%d confirmations "+
"(need %d more blocks)",
dep.Outpoint, dep.CurrentConfirmations,
dep.RequiredConfirmations, dep.BlocksToWait)

Choose a reason for hiding this comment

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

medium

For better readability and to avoid string concatenation, you can include the full format string directly in log.Warnf.

log.Warnf("  Deposit %s: %d/%d confirmations (need %d more blocks)",
    dep.Outpoint, dep.CurrentConfirmations,
    dep.RequiredConfirmations, dep.BlocksToWait)

@hieblmi hieblmi self-assigned this Jan 9, 2026
@hieblmi hieblmi marked this pull request as draft January 9, 2026 13:45
Add DepositConfirmationStatus and InsufficientConfirmationsDetails
messages to support structured error responses when deposits lack
sufficient confirmations for dynamic risk requirements.
- Reduce MinConfs from 6 to 1 to allow faster swap attempts for small
  amounts while the server enforces risk-based confirmation requirements
- Update SelectDeposits to prioritize more-confirmed deposits first,
  increasing the likelihood of server acceptance
- Add client-side logging of insufficient confirmation details from
  server errors, helping users understand when deposits need more
  confirmations
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.

1 participant