Skip to content

swapserverrpc: arbitrary static swap amount #951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hieblmi
Copy link
Collaborator

@hieblmi hieblmi commented Jun 11, 2025

This PR adds an amount field to the ServerStaticAddressLoopInRequest.

    The optional swap amount the client is attempting to swap. If specified the
    server will take out this amount from the total value of provided
    deposit_outpoints and will send the change back to the static address. If
    this results in dust change the server will reject the swap request. If the
    amount is not specified the server will use the total amount of the
    deposit_outpoints as swap amount without providing an additional flag - this
    is due to backwards compatibility.
   

@hieblmi hieblmi self-assigned this Jun 11, 2025
@hieblmi hieblmi requested review from bhandras, starius and sputn1ck June 11, 2025 13:31
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 🎉

@hieblmi hieblmi force-pushed the swap-amount-rpcs branch 3 times, most recently from f87ec32 to 947d08b Compare June 17, 2025 18:00
Copy link
Collaborator

@starius starius left a comment

Choose a reason for hiding this comment

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

LGTM! 🌴
One comment.

server will take out this amount from the total value of provided
deposit_outpoints and will send the change back to the static address. If
not specified the server will use the total amount of the deposit_outpoints
as swap amount.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens, if the amount is too close to the total amount (so the change would be dust)? I think it makes sense if it fails and suggests to remove the flag to use the whole amount.
Could you add the actual expected behavior in this case to the comment, please?

Also, if the amount is equal to the total amount, it makes sense just to succeed, right? And if higher - fail.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I expanded the comment to explain.

Note, there is no flag to use the whole amount of provided deposits for backwards compatibility. If deposits are specified without an amount the whole amount is used.

@hieblmi hieblmi force-pushed the swap-amount-rpcs branch from 947d08b to 3fc955f Compare June 25, 2025 10:23
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