Update protocol for continuous inbound liquidity#618
Closed
Conversation
05b49a8 to
b23a526
Compare
It is usually the wallet that decides that it needs a channel, but we want the LSP to pay the commit fees to allow the wallet user to empty its wallet over lightning. We previously used a `please_open_channel` message that was sent by the wallet to the LSP, but it doesn't work well with liquidity ads. We remove that message and instead send `open_channel` from the wallet but with a custom channel flag that tells the LSP that they should be paying the commit fees. This only works if the LSP adds funds on their side of the channel, so we couple that with liquidity ads to request funds from the LSP.
We previously only used liquidity ads with splicing: we now support it during the initial channel opening flow as well. This lets us add more unit tests, including tests for the case where the node receiving the `open_channel` message is responsible for paying the commitment fees.
736e40c to
404125f
Compare
We replace the previous pay-to-open protocol with a new protocol that only relies on liquidity ads for paying fees. We simply transmit HTLCs that cannot be relayed on existing channels with a new message called `maybe_add_htlc` that contains all the HTLC data. If the recipient wishes to accept that payment, it reveals the preimage when sending `open_channel2` or `splice_init` and marks the on-chain part of that payment as pending. It then keeps retrying the on-chain funding operation until it completes or our peer sends a dedicated error asking us to cancel it.
The liquidity seller may adapt their lease rates to the funding amount, to account for the fact that higher amounts will require more inputs, and thus a larger `funding_weight`.
Add more node events for on-the-fly funding operations. This is mostly useful for tests to wait until specific steps have been reached into the protocol execution.
404125f to
3c20b3f
Compare
We add an optional feature that lets on-the-fly funding clients accept payments that are too small to pay the fees for an on-the-fly funding. When that happens, the payment amount is added as "fee credit" without performing an on-chain operation. Once enough fee credit has been obtained, we can initiate an on-chain operation to create a channel or a splice. This feature makes more efficient use of on-chain transactions by trusting that our peer will honor our fee credit in the future.
Member
Author
|
Replaced by #649 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
We also introduce an optional
fee_creditfeature, that is disabled by default (because it introduces an additional trust trade-off with the service provider), which allows wallets to accept small payments for which an on-chain operation is not economical, and obtain a fee credit in exchange for a future on-chain operation.The main changes to the protocol are:
open_channel2andsplice_init)interactive-txprotocolpay_to_openmessages with a singlemaybe_add_htlcmessage, which is a clone ofupdate_add_htlcwithout achannel_idorhtlc_id:IncomingPaymentHandleropen_channel2orsplice_init:open_channel2/splice_initon reconnectionmaybe_add_htlcmessage: the service provider will automatically fail the corresponding HTLCs after a short timeoutPendingentry that must later by replaced by the final result: this must be correctly implemented on the wallet side when implementing thePaymentsDbtrait!