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.
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:
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.
Most helpful comment
To outline things a bit further, there're two main areas which are prime targets for integrating things within lnd:
A rough outline of the new abstraction to implement this feature might look something along the lines of:
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.