-
Notifications
You must be signed in to change notification settings - Fork 123
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
f87ec32
to
947d08b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🌴
One comment.
swapserverrpc/staticaddr.proto
Outdated
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
72e88de
to
d023b0c
Compare
Rebased master |
Optional change of a swap is encoded in its sweeps as a pointer to the same change output. This change is taken into account when constructing the unsigned batch transaction when it comes to tx weight and outputs.
Presigning sweeps takes change outputs into account. Each sweep belonging to the same sweep group points to the same change output, if existent. sweepbatcher.presign scans all passed sweeps for change outputs and passes them to constructUnsignedTx.
The batcher now presigns sweep groups including an optional change output. Change is usually leftover from the client's swap amount which is returned to the client.
This PR adds an
amount
field to theServerStaticAddressLoopInRequest
.