You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: fund channel with all available funds, or a specific output #665
featureAimed at improving the existing functionality or a new feature that provides additional valuehx G4OLabel hx used as 'good for onboarding' but some issues may not still be true to that definition.json-rpc
Agree. I accidentally sent ~8000 satoshis to a change address when doing my first channel opening. My own fault, but an easier way to force spending all available funds and not producing a change UTXO would be useful.
Suggestion for those who want to consider taking this issue: withdraw command supports all input to withdraw all funds; it may be useful to unify the code with withdraw, then support selecting an output by "txid:outnum" form in the unified code (to fund using a specific output). This implies adding a wrapper around wallet_select_coins/wallet_select_all.
I added support to fundchannel to accept "all". For now, I just made json_fund_channel look as close to a copy of json_withdraw as possible. Now, as @ZmnSCPxj suggests, I will unify the code and also support selecting a specific output.
It worked on testnet for me, and I added a test_funding_all python test.
Its all on my fund_all branch. Should I make a pull request and mark as work-in-progress?
Yes, please make pull request, thank you! It could be marked WIP if you intend to also add the specific-output support in the same pull request but we could also do a separate pull request for the specific-output support.
why limit ourselves to a 1) specific amount, 2) 'all', or 3) a specific manually selected utxo?
i think fundchannel should take a range, like
fundchannel X 10000-16000
and the lightning deamon would find "hey i can use this old 12000 utxo to fund the channel"
or "i can use my 7000+6000 utxo:s and make a 13000 channel"
if it doesn't easily find any suitable utxo[s], go ahead and do it the old way.
i mean, we are funding our own channel, not sending money to someone, thus it doesn't have to be exact. and i'd rather leave some satoshis extra in the channel, than getting it back in a silly exchange utxo.
(disclaimer: i'm pretty sure i have suggested the same thing before, but i can't remember where, might have been lnd related. anyhows, sorry for repeating myself. i usually only do that until i get what i want)
I'd rather not make this RPC call any more complex than necessary. We can always add a new RPC command, and then we can externalize the coinselection completely, i.e., pass in a list of outputs that should be selected for the funding, and a value, similar to createrawtransaction in bitcoind.
featureAimed at improving the existing functionality or a new feature that provides additional valuehx G4OLabel hx used as 'good for onboarding' but some issues may not still be true to that definition.json-rpc
Activity
gdistasi commentedon Jan 19, 2018
I agree, this is a very useful feature.
windsok commentedon Jan 22, 2018
Agree. I accidentally sent ~8000 satoshis to a change address when doing my first channel opening. My own fault, but an easier way to force spending all available funds and not producing a change UTXO would be useful.
Sjors commentedon Feb 24, 2018
With fees ticking up again, it's now spending ~€1.50 to open a channel, this becomes more relevant.
cdecker commentedon Mar 4, 2018
Marking as good first issue, shouldn't be too hard and it's a good exercise in getting acquainted with the source.
ZmnSCPxj commentedon Mar 4, 2018
Suggestion for those who want to consider taking this issue:
withdrawcommand supportsallinput to withdraw all funds; it may be useful to unify the code withwithdraw, then support selecting an output by "txid:outnum" form in the unified code (to fund using a specific output). This implies adding a wrapper aroundwallet_select_coins/wallet_select_all.wythe commentedon Mar 19, 2018
I added support to fundchannel to accept "all". For now, I just made
json_fund_channellook as close to a copy ofjson_withdrawas possible. Now, as @ZmnSCPxj suggests, I will unify the code and also support selecting a specific output.It worked on testnet for me, and I added a
test_funding_allpython test.Its all on my
fund_allbranch. Should I make a pull request and mark as work-in-progress?ZmnSCPxj commentedon Mar 19, 2018
Yes, please make pull request, thank you! It could be marked WIP if you intend to also add the specific-output support in the same pull request but we could also do a separate pull request for the specific-output support.
wythe commentedon Mar 19, 2018
Ok sounds like a plan. Will do.
Removed redundancies in withdraw and fundchannel.
robtex commentedon Apr 22, 2018
why limit ourselves to a 1) specific amount, 2) 'all', or 3) a specific manually selected utxo?
i think fundchannel should take a range, like
fundchannel X 10000-16000
and the lightning deamon would find "hey i can use this old 12000 utxo to fund the channel"
or "i can use my 7000+6000 utxo:s and make a 13000 channel"
if it doesn't easily find any suitable utxo[s], go ahead and do it the old way.
i mean, we are funding our own channel, not sending money to someone, thus it doesn't have to be exact. and i'd rather leave some satoshis extra in the channel, than getting it back in a silly exchange utxo.
(disclaimer: i'm pretty sure i have suggested the same thing before, but i can't remember where, might have been lnd related. anyhows, sorry for repeating myself. i usually only do that until i get what i want)
wythe commentedon Apr 24, 2018
I hear you @robtex. Maybe another option, closest fit:
fundchannel fit 10000 16000I also am experimenting with providing a list of utxos instead of just a single one.
cdecker commentedon Apr 24, 2018
I'd rather not make this RPC call any more complex than necessary. We can always add a new RPC command, and then we can externalize the coinselection completely, i.e., pass in a list of outputs that should be selected for the funding, and a value, similar to
createrawtransactioninbitcoind.wythe commentedon Apr 25, 2018
Yeah that makes sense. Should I even add support for specifying the single utxo?
Removed redundancies in withdraw and fundchannel.
cdecker commentedon Apr 27, 2018
Well, that'd be covered by the
manualfundchannelcase, wouldn't it?Removed redundancies in withdraw and fundchannel.
wythe commentedon Apr 27, 2018
Yes.
Removed redundancies in withdraw and fundchannel.
Removed redundancies in withdraw and fundchannel.
Removed redundancies in withdraw and fundchannel.
Removed redundancies in withdraw and fundchannel.
Removed redundancies in withdraw and fundchannel.
Removed redundancies in withdraw and fundchannel.
jb55 commentedon Jul 24, 2018
This is implemented now, can this be closed?
Sjors commentedon Jul 25, 2018
Ah, I totally missed that. This was added in #1399 even though the description says it wasn't? Nice!