-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update protocol for continuous inbound liquidity #618
Closed
Closed
Conversation
This file contains 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
t-bast
force-pushed
the
continuous-liquidity-ads
branch
4 times, most recently
from
March 13, 2024 10:02
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.
t-bast
force-pushed
the
continuous-liquidity-ads
branch
7 times, most recently
from
March 20, 2024 14:53
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.
t-bast
force-pushed
the
continuous-liquidity-ads
branch
from
March 25, 2024 11:14
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.
Replaced by #649 |
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_credit
feature, 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_channel2
andsplice_init
)interactive-tx
protocolpay_to_open
messages with a singlemaybe_add_htlc
message, which is a clone ofupdate_add_htlc
without achannel_id
orhtlc_id
:IncomingPaymentHandler
open_channel2
orsplice_init
:open_channel2
/splice_init
on reconnectionmaybe_add_htlc
message: the service provider will automatically fail the corresponding HTLCs after a short timeoutPending
entry that must later by replaced by the final result: this must be correctly implemented on the wallet side when implementing thePaymentsDb
trait!