lightning-kmp
lightning-kmp copied to clipboard
On-the-fly channel funding based on splicing and liquidity ads
We revamp our protocols for on-the-fly funding to use a unified approach based on liquidity ads. We simplify messages exchanged and reduce the number of custom extensions required on top of the BOLT specifications.
The main changes to the protocol are:
- the wallet initiates all channel operations (it is responsible for sending
open_channel2
andsplice_init
)- it thus automatically pays the on-chain fees for the common transaction fields, as specified by the
interactive-tx
protocol - it uses a custom channel flag to ask the service provider to pay the commit tx fees and closing fees (won't be necessary anymore once we use 0-fee commit txs with package relay), which enables 0-reserve and allows emptying a wallet using an off-chain payment
- it thus automatically pays the on-chain fees for the common transaction fields, as specified by the
- we replace the
pay_to_open
messages with awill_add_htlc
message, which is a clone ofupdate_add_htlc
without achannel_id
orhtlc_id
:- the wallet processes them in the
IncomingPaymentHandler
- if it wishes to fulfill them, it first sends
open_channel2
orsplice_init
to purchase enough liquidity:- we introduce new payment options that can be used with liquidity ads to pay the fees from the HTLCs themselves
- the wallet processes them in the
- the only fees that are applied are the liquidity ads fees:
- on-chain fees for the inputs/outputs contributed by the service provider to add inbound liquidity (as specified by the liquidity ads protocol)
- service fees for the inbound liquidity purchased (as specified by the liquidity ads protocol)
The specification can be found in https://github.com/lightning/blips/pull/36. An implementation of the seller side is available in https://github.com/ACINQ/eclair/pull/2861.
This PR is best reviewed commit-by-commit: each commit is self-contained and contains a piece of the puzzle.
Replaces #618.