Skip to content

Allow peers to use open_channel even if both peers support dual funding #7119

Open
@ErikDeSmedt

Description

@ErikDeSmedt

Is it possible for peers to still use v1 if they both support dual-funing?

Here is a short motivating example.
I've been struggling with defining cancellable channel-opens using v2 of the channel open protocol.

I've been trying to implemnt LSPS1 as a core-lightning plug-in.

The protocol allows an LSP-client can purchase a channel from an LSP-server.
The client orders the channel and pays a BOLT-11 invoice.
The server should HOLD the incoming HTLC's and attempt to open the channel.
The server can claim the funds once the channel has been negotiated successfully.
If the channel open fails, the server should refund the HTLC.

To implement this safely, a server must ensure that a channel open is cancelled before refunding the HTLC.
If this doesn't work properly the server might refund the channel and still carry the cost of opening the channel.

To implement this I've been using the fundchannel_start, fundchannel_complete and fundchannel_cancel rpc-command.

When the server receives an incoming paymnet it will

  • use fundchannel_start to negotiate the channel
  • construct the funding transaction
  • call fundchannel_complete to secure the commitment transaction
  • claim the HTLC
  • call fundchannel_complete to publish the funding-transaction

This implementation is safe it ensures

  • the server never publishes a funding transaction before claiming the HTLC
  • the server can always publish the channel after claiming the HTLC

This implementation is working with v1 of the open_channel protocol.
However, if both peers support dual_funding this approach fails.

{
   "code": 312,
   "message": "Peer negotiated `option_dual_fund`, must use `openchannel_init` not `fundchannel_start`."
}

I'd like to avoid implementing this logic twice.

  • Is it possible for peers to still use v1 if they both support dual-funding?
  • Is their an alternative solution to prevent me from having to implement this logic twice?

@niftynei

Activity

niftynei

niftynei commented on Aug 19, 2024

@niftynei
Contributor

Is it possible for peers to still use v1 if they both support dual-funding?

Not as currently specified, no.

I've been struggling with defining cancellable channel-opens using v2 of the channel open protocol.

openchannel_abort is a decent substitute for fundchannel_cancel with the difference being that you can't abort a channel after you've sent your signatures for the commitment transaction.

You can integrate with the v2 flow, its just different from fundchannel_ flows.

  • use openchannel_init to negotiate the channel
  • negotiate the funding transaction
  • call openchannel_update until the commitment transaction is secured
  • claim the HTLC
  • call sign the funding transaction and call openchannel_signed to push our sigs to the peer + broadcast the funding-transaction once the peer's sigs have been received (if necessary)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @cdecker@niftynei@ErikDeSmedt

        Issue actions

          Allow peers to use `open_channel` even if both peers support dual funding · Issue #7119 · ElementsProject/lightning