Skip to content
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

Feature Request: fund channel with all available funds, or a specific output #665

Closed
Sjors opened this issue Jan 19, 2018 · 16 comments
Closed
Labels

Comments

@Sjors
Copy link
Contributor

Sjors commented Jan 19, 2018

Avoids the need for a change address, especially if you want to put all available funds in a single channel.

@gdistasi
Copy link

I agree, this is a very useful feature.

@windsok
Copy link
Contributor

windsok commented 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
Copy link
Contributor Author

Sjors commented Feb 24, 2018

With fees ticking up again, it's now spending ~€1.50 to open a channel, this becomes more relevant.

@cdecker cdecker added the good first issue good for onboarding label Mar 4, 2018
@cdecker
Copy link
Member

cdecker commented 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
Copy link
Collaborator

ZmnSCPxj commented Mar 4, 2018

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.

@wythe
Copy link
Collaborator

wythe commented Mar 19, 2018

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?

@ZmnSCPxj
Copy link
Collaborator

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
Copy link
Collaborator

wythe commented Mar 19, 2018

Ok sounds like a plan. Will do.

@wythe wythe mentioned this issue Mar 19, 2018
wythe added a commit to wythe/lightning that referenced this issue Apr 20, 2018
No new functionality, just a continuation of my work toward completing ElementsProject#665.

I removed the common members of `struct withdrawal` and `struct fund_channel`
and placed them in a new `struct wallet_tx`.  Then it was fairly straightforward
to reimplement the existing code in terms of `wallet_tx`.

Since I made some structural changes I wanted to get this approved before I
go any farther.
@robtex
Copy link

robtex commented 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
Copy link
Collaborator

wythe commented Apr 24, 2018

I hear you @robtex. Maybe another option, closest fit:
fundchannel fit 10000 16000

I also am experimenting with providing a list of utxos instead of just a single one.

@cdecker
Copy link
Member

cdecker commented 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 createrawtransaction in bitcoind.

@wythe
Copy link
Collaborator

wythe commented Apr 25, 2018

Yeah that makes sense. Should I even add support for specifying the single utxo?

wythe added a commit to wythe/lightning that referenced this issue Apr 25, 2018
No new functionality, just a continuation of my work toward completing ElementsProject#665.

I removed the common members of `struct withdrawal` and `struct fund_channel`
and placed them in a new `struct wallet_tx`.  Then it was fairly straightforward
to reimplement the existing code in terms of `wallet_tx`.

Since I made some structural changes I wanted to get this approved before I
go any farther.
@cdecker
Copy link
Member

cdecker commented Apr 27, 2018

Well, that'd be covered by the manualfundchannel case, wouldn't it?

wythe added a commit to wythe/lightning that referenced this issue Apr 27, 2018
No new functionality, just a continuation of my work toward completing ElementsProject#665.

I removed the common members of `struct withdrawal` and `struct fund_channel`
and placed them in a new `struct wallet_tx`.  Then it was fairly straightforward
to reimplement the existing code in terms of `wallet_tx`.

Since I made some structural changes I wanted to get this approved before I
go any farther.
@wythe
Copy link
Collaborator

wythe commented Apr 27, 2018

Yes.

wythe added a commit to wythe/lightning that referenced this issue Apr 27, 2018
No new functionality, just a continuation of my work toward completing ElementsProject#665.

I removed the common members of `struct withdrawal` and `struct fund_channel`
and placed them in a new `struct wallet_tx`.  Then it was fairly straightforward
to reimplement the existing code in terms of `wallet_tx`.

Since I made some structural changes I wanted to get this approved before I
go any farther.

Added 'all' to fundchannel help message.
wythe added a commit to wythe/lightning that referenced this issue Apr 29, 2018
No new functionality, just a continuation of my work toward completing ElementsProject#665.

I removed the common members of `struct withdrawal` and `struct fund_channel`
and placed them in a new `struct wallet_tx`.  Then it was fairly straightforward
to reimplement the existing code in terms of `wallet_tx`.

Since I made some structural changes I wanted to get this approved before I
go any farther.

Added 'all' to fundchannel help message.
wythe added a commit to wythe/lightning that referenced this issue Apr 30, 2018
No new functionality, just a continuation of my work toward completing ElementsProject#665.

I removed the common members of `struct withdrawal` and `struct fund_channel`
and placed them in a new `struct wallet_tx`.  Then it was fairly straightforward
to reimplement the existing code in terms of `wallet_tx`.

Since I made some structural changes I wanted to get this approved before I
go any farther.

Added 'all' to fundchannel help message.
wythe added a commit to wythe/lightning that referenced this issue May 2, 2018
No new functionality, just a continuation of my work toward completing ElementsProject#665.

I removed the common members of `struct withdrawal` and `struct fund_channel`
and placed them in a new `struct wallet_tx`.  Then it was fairly straightforward
to reimplement the existing code in terms of `wallet_tx`.

Since I made some structural changes I wanted to get this approved before I
go any farther.

Added 'all' to fundchannel help message.
wythe added a commit to wythe/lightning that referenced this issue May 2, 2018
No new functionality, just a continuation of my work toward completing ElementsProject#665.

I removed the common members of `struct withdrawal` and `struct fund_channel`
and placed them in a new `struct wallet_tx`.  Then it was fairly straightforward
to reimplement the existing code in terms of `wallet_tx`.

Since I made some structural changes I wanted to get this approved before I
go any farther.

Added 'all' to fundchannel help message.
cdecker pushed a commit that referenced this issue May 3, 2018
No new functionality, just a continuation of my work toward completing #665.

I removed the common members of `struct withdrawal` and `struct fund_channel`
and placed them in a new `struct wallet_tx`.  Then it was fairly straightforward
to reimplement the existing code in terms of `wallet_tx`.

Since I made some structural changes I wanted to get this approved before I
go any farther.

Added 'all' to fundchannel help message.
@jb55
Copy link
Collaborator

jb55 commented Jul 24, 2018

This is implemented now, can this be closed?

@Sjors
Copy link
Contributor Author

Sjors commented Jul 25, 2018

Ah, I totally missed that. This was added in #1399 even though the description says it wasn't? Nice!

No new functionality, just a continuation of my work toward completing #665

@Sjors Sjors closed this as completed Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants