Skip to content

Conversation

hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented Oct 8, 2025

Before:

{
    "swap_hash": "d2a5599947000441928bb283f0d9ab322b153d83af747e67da54d579038fba42",
    "state": "SignHtlcTx",
    "amount": "266000",
    "htlc_cltv": 273533,
    "quoted_swap_fee_satoshis": "1422",
    "max_swap_fee_satoshis": "1422",
    "initiation_height": 273033,
    "protocol_version": "V0",
    "label": "",
    "initiator": "loop-cli",
    "payment_timeout_seconds": 60
}

After:

{
    "swap_hash": "f0cb51c09f10f80fa803d9d037e265b0e95aaecc69a5c9d3a1986eb50c64b327",
    "state": "InitHtlcTx",
    "amount": "600000",
    "htlc_cltv": 1149,
    "quoted_swap_fee_satoshis": "6424",
    "max_swap_fee_satoshis": "6424",
    "initiation_height": 149,
    "protocol_version": "V0",
    "label": "",
    "initiator": "loop-cli",
    "payment_timeout_seconds": 60,
    "used_deposits": [
        {
            "id": "1273d92a7401d7f11b965be0c8bd0e680ae25aa5c06a7b5a28e109db0b0d0129",
            "state": "LOOPING_IN",
            "outpoint": "3412f984a7cc7745b0552a091a0edebc343badbe8f3344ff0e40b3eab635e693:1",
            "value": "300000",
            "confirmation_height": "144",
            "blocks_until_expiry": "2000",
            "swap_hash": ""
        },
        {
            "id": "39bef5ca1500f0f78e9c749d405b9d724bf56e022c3be9f0e2d38ac47ff99c23",
            "state": "LOOPING_IN",
            "outpoint": "4fb923521beeef3c2680c1de9b65d5d0dcbfdac50f959f63d94b970120f966ce:1",
            "value": "300000",
            "confirmation_height": "144",
            "blocks_until_expiry": "2000",
            "swap_hash": ""
        }
    ],
    "swap_amount": "500000",
    "change": "100000",
    "fast": true
}

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 expands the StaticAddressLoopInResponse message to include more comprehensive details about static address loop-in swaps. It introduces fields for used_deposits, swap_amount, change, and fast publication status. The server-side logic has been updated to calculate and populate these new fields, providing clients with a clearer picture of the swap's execution and parameters.

Highlights

  • Intent: This pull request enhances the StaticAddressLoopInResponse by adding several new fields to provide more detailed information about a static address loop-in swap.
  • Key Changes: The primary changes involve modifying the StaticAddressLoopInResponse message across the protobuf definition, its generated Go code, and the Swagger documentation. New fields added include used_deposits (a list of Deposit objects), swap_amount (the actual amount being swapped, potentially less than the total deposit if change is returned), change (the amount returned to the static address), and fast (a boolean indicating if fast publication was requested). The loopd/swapclient_server.go file has been updated to correctly populate these new fields in the response, including logic to calculate the swap_amount and change based on the selected deposit amounts.
  • Impact: Clients consuming the StaticAddressLoopInResponse will now receive richer data, allowing for a more complete understanding of the swap's details, including the specific inputs (deposits), the net amount swapped, any change returned, and the requested transaction speed. This improves transparency and diagnostic capabilities for static address loop-in operations.
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 enhances the StaticAddressLoopInResponse by adding several new fields, providing more detailed information about the swap. The changes to the protobuf definitions and generated files are consistent and well-executed.

I've identified one significant issue in the implementation regarding error handling that could lead to unexpected behavior for the user. Please see my detailed comment below.

@starius
Copy link
Collaborator

starius commented Oct 8, 2025

"blocks_until_expiry" is 0 in the output.
lncli listdeposits shows correct numbers for "blocks_until_expiry".

@hieblmi
Copy link
Collaborator Author

hieblmi commented Oct 9, 2025

"blocks_until_expiry" is 0 in the output. lncli listdeposits shows correct numbers for "blocks_until_expiry".

fixed by refactoring the calculation of the blocks until expiry and using it in the deposit list response.

Copy link
Member

@sputn1ck sputn1ck left a comment

Choose a reason for hiding this comment

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

LGTM

@hieblmi hieblmi requested a review from bhandras October 9, 2025 08:59
@hieblmi hieblmi merged commit 7193552 into lightninglabs:master Oct 9, 2025
6 checks passed
@hieblmi hieblmi deleted the show-deposits branch October 9, 2025 09:59
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.

4 participants