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] Open (close) multiple channels with one on-chain transaction #3772

Closed
manreo opened this issue Nov 28, 2019 · 5 comments
Closed
Assignees
Labels
channels enhancement Improvements to existing features / behaviour feature request Requests for new features funding Related to the opening of new channels with funding transactions on the blockchain intermediate Issues suitable for developers moderately familiar with the codebase and LN P3 might get fixed, nice to have v0.12
Milestone

Comments

@manreo
Copy link
Contributor

manreo commented Nov 28, 2019

Background

As in here:
ElementsProject/lightning#1936

I believe the API of c-lightning could be extended to support a batch channel open (and consequently also a batch channel closing command). I believe there is quite some protocol overhead as communication with all channel partners has to be established and commitment txs have to be signed before the batch funding tx could be published. However I think this would not interfere with the current protocol specification for channel establishment.

@Roasbeef
Copy link
Member

I have a branch locally that does this for opening multiple channels in a single transaction. Once #3659 lands, it has the functionality needed to work properly. It isn't possible to co-op close multiple channels in a single transaction in the current protocol.

@manreo
Copy link
Contributor Author

manreo commented Nov 30, 2019

Excellent news @Roasbeef , can you tag it as a feature request and set the milestone correctly (Or just close the ticket and open a better constructed one :) ). Because as far as I can see, #3659 does not seem to write explicitly on batch channel opening.

Thanks

@wpaulino wpaulino added channels enhancement Improvements to existing features / behaviour feature request Requests for new features funding Related to the opening of new channels with funding transactions on the blockchain labels Dec 2, 2019
@manreo
Copy link
Contributor Author

manreo commented Dec 19, 2019

Hi Mr @Roasbeef , #3659 has landed 🛬.. What about your local branch?

@manreo manreo changed the title Feature request: Open (close) multiple channels with one on-chain transaction [Feature request] Open (close) multiple channels with one on-chain transaction Dec 26, 2019
@Roasbeef Roasbeef added this to the 0.10.0 milestone Jan 14, 2020
@Roasbeef Roasbeef self-assigned this Jan 17, 2020
@Roasbeef Roasbeef assigned guggero and Roasbeef and unassigned Roasbeef Jan 17, 2020
@Roasbeef
Copy link
Member

To outline things a bit further, there're two main areas which are prime targets for integrating things within lnd:

  1. When the autopilot agent is about to create a series of channels, atm it creates them all individually. This results in s a series of unnecessary transaction, as we already know all the channels that we want to open up front, so therefore can merge them all into a single channel.
  2. When the user creates a series of channels over the RPC interface. Similar to the above case, assuming that they already know all of the channels they want to create a head of time, they can specify a new param that will know to merge all the channels up front.

A rough outline of the new abstraction to implement this feature might look something along the lines of:

+package chanfunding
+
+// MergeableAssembler...
+//
+// TODO(roasbeef): for batch channel funding internally?
+//  * funding mgr can merge in as they come in, with a delay to broadcast them
+//  * first broadcast method triggers the rest, and they return nil
+type MergeableAssembler interface {
+       Assembler
+
+       // MergeIntents...
+       //
+       // TODO(roasbeef): merges multiple into a single batch transaction
+       MergeIntents(intents []Intent) (Intent, error)
+}
+
+// MergeIntents...
+//
+// TODO(roasbeef): merges multiple into a single batch transaction
+func (m *WalletAssembler) MergeIntents(intents []Intent) (Intent, error) {
+       return nil, nil
+}
+
+var _ MergeableAssembler = (*WalletAssembler)(nil)

So first the caller creates a set of normal intents, which is then merged into a single intent (and single transaction) by the wallet. This can eventually also have some interplay with #3936, but we'll leave that for another chapter in the future.

@cfromknecht cfromknecht modified the milestones: 0.11.0, 0.12.0 Jun 26, 2020
@Roasbeef Roasbeef modified the milestones: 0.12.0, 0.13.0 Oct 1, 2020
@Roasbeef Roasbeef added the P3 might get fixed, nice to have label Jan 28, 2021
@Roasbeef Roasbeef added the intermediate Issues suitable for developers moderately familiar with the codebase and LN label Mar 23, 2021
@Roasbeef Roasbeef modified the milestones: 0.13.0, v0.14.0 Mar 31, 2021
@guggero
Copy link
Collaborator

guggero commented Sep 9, 2021

Implemented in #5356.

@guggero guggero closed this as completed Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
channels enhancement Improvements to existing features / behaviour feature request Requests for new features funding Related to the opening of new channels with funding transactions on the blockchain intermediate Issues suitable for developers moderately familiar with the codebase and LN P3 might get fixed, nice to have v0.12
Projects
None yet
Development

No branches or pull requests

6 participants