L2-Technology / sensei

A lightning node implementation for everyone
https://l2.technology/sensei
Other
199 stars 39 forks source link

batch channel opens #79

Closed johncantrell97 closed 2 years ago

johncantrell97 commented 2 years ago

Adds a ChannelOpener struct that orchestrates batch channel opens. A batch channel open is one where you can open multiple channels using a single on-chain transaction.

Right now LDK doesn't "officially" support this (https://github.com/lightningdevkit/rust-lightning/issues/1510) but was able to work around these issues with a few workarounds.

Added a new NodeRequest::OpenChannels that lets you provide a Vec of channels to open. Also updated NodeRequest::OpenChannel to use batch channel open flow with a batch of size 1.

The [wip] part of this is around the actual API. Right now there is no actual api exposed. The other issue is around how to handle (and respond) when some of the channels fail to open for whatever reason.

Right now the workflow keeps track of all open requests individually and the plan is to return list of tuples like this: Vec<(open_request,open_result)>

johncantrell97 commented 2 years ago

Just updated this with a unified open channel api. Instead of having two endpoints there will just be a single one that accepts a list of channel opens. The client libraries can expose helpers for working with single vs batch channel opens.

Going to update the JS library and the web ui next.