lnd
lnd copied to clipboard
[Request] sendcoins all / openchannel all
Reason: Currently, if I want to spend 100% of my funds onchain OR spend 100% of my funds to a channel, I need to dance back and forth by overshooting it and seeing the error message telling me how much I need, subtract, then send the exact amount.
Flow
- User specifies in the args that "I want to send as much as possible accounting for fees" (
ALLin place of the local_amt etc.) - lnd calculates the fees for the opening channel transaction normally, and subtracts that from available witness outputs (for openchannel) or all inputs (for sendcoins) and performs the send operation without interaction from the user.
I will give it crack!
@t4sk are you actively working on this?
@githubsands I am planning to work on it this weekend but I am also happy to hand it over to you :)
AFAIK, this issue is still up for grabs!
This would actually be super useful. I might pick it up if nobody else has raised a PR.
For the openchannel case I feel like the main issue here is that the user has to guess the fee. For example the following flow is frustrating:
$ lncli walletbalance
{
"total_balance": "16768865",
"confirmed_balance": "16768865",
"unconfirmed_balance": "0"
}
$ lncli openchannel 03dfb7ad0bda82ecb7b516a57c914bbcb71a58cf4f70d22d313731b33a9a7de3d0 16768865
[lncli] rpc error: code = Unknown desc = not enough witness outputs to create funding transaction, need 0.16776515 BTC only have 0.16768865 BTC available
We could take the fee from local_amt by default, but the change of behaviour might surprise users. We could also add a new option such as --include-fee that makes it explicit that the local_amt includes the fee.
Finally, do we want to commit 100% to channel balances, or should we reserve a certain amount in case fees increase later on? From BOLT2:
Given the variance in fees, and the fact that the transaction may be spent in the future, it's a good idea for the fee payer to keep a good margin (say 5x the expected fee requirement); but, due to differing methods of fee estimation, an exact value is not specified.
a new option such as --include-fee
This should be sufficient.
do we want to commit 100% to channel balances
This could also be another arg.
So in summary:
- Add
--include-feearg to openchannel and sencoins. - Add
--ignore-fee-bufferfor openchannel (assuming lnd is already calculating some buffer for fees that it is not allowing to be used for openchannel) to ignore the buffer and allow sending all funds to an openchannel.
I was confusing the fee for the funding tx and the commitment tx. In this issue I only really care about the funding tx.
This feature is really needed, any progress?
See #2198
The ability to send all the coins out of the wallet has been merged. The follow up would be a similar command to take all those UTXOs and fund a channel.
I will take a look and try to implement the functionality of this for opening channels.
Will be fixed by #4029.
Will be fixed by https://github.com/lightningnetwork/lnd/pull/6903 owned by @hieblmi