Lnd: [Feature request] Open (close) multiple channels with one on-chain transaction

Created on 28 Nov 2019  路  4Comments  路  Source: lightningnetwork/lnd

Background

As in here:
https://github.com/ElementsProject/lightning/issues/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.

channels enhancement feature request funding v0.12

Most helpful comment

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.

All 4 comments

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.

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

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

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.

Was this page helpful?
0 / 5 - 0 ratings