Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
adds `fundall` flag to `openchannel` #4029
Related to PR #4024, but reopened as a new PR as this feature has undergone major changes.
This PR introduces a new flag
See also #619
Wanting to use the total available wallet balance in the local amount when opening a channel requires calculating the needed fee and subtracting it from the balance manually.
A new coin select function
This implementation should be concurrent safe, becuase it locks the coins prior to selecting them, as currently done by the wallet assembler for the coin select subroutine.
Pull Request Checklist
I was trying to use this flag, but since the maximum funding amount is limited to the constant
But I did use the
I saw there may also be an open TODO in that regard for the excess fee. Furthermore,
@bjarnemagnussen I'm not sure I understand the limitation of the current API. If you do a regular channel opening with the
@halseth This works well, and I have added a commit to do as you suggest! :) Hopefully this is something along the line of what you were thinking?
Mismatch between coin select functions
There is this little mismatch between
An easy fix is to use a sanity check that simply makes sure that we do not return an amount greater than what we asked for. Any difference should be small (fee difference between one and no change output) and can directly go towards the fee.
I have for now added a test case "WIP: mismatch of fee calculation between functions" that will pass due to the added sanity check explained above, but otherwise would give rise to an output amount greater than the specified maximum.
There is also an oddity regarding testing for dust change, as it depends on which branch inside
halseth left a comment
This looks pretty good! Could an alternative way to communicate our intention to use all our funds to the wallet be a
We could also take this a step further and create a
bjarnemagnussen left a comment
Thanks @halseth for your review and the helpful inputs!
I have been considering this. But there were a few things I fell over:
I am therefore not sure if we can work around this in another way?
I like your idea of defining a