Add fee credit feature for on-the-fly funding#660
Merged
Conversation
21d9fae to
2f5f38a
Compare
2f5f38a to
e6f9236
Compare
e6f9236 to
850f884
Compare
850f884 to
40dd1dd
Compare
40dd1dd to
a7caee0
Compare
0de4be2 to
9aa22ff
Compare
8e8add2 to
969560e
Compare
969560e to
2b3062f
Compare
pm47
reviewed
Sep 23, 2024
src/commonMain/kotlin/fr/acinq/lightning/payment/IncomingPaymentHandler.kt
Outdated
Show resolved
Hide resolved
pm47
reviewed
Sep 23, 2024
src/commonMain/kotlin/fr/acinq/lightning/payment/IncomingPaymentHandler.kt
Show resolved
Hide resolved
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 by paying part of the fees from our fee credit. This feature makes more efficient use of on-chain transactions by trusting that our peer will honor our fee credit in the future. The fee credit takes precedence over other ways of paying the fees (from our channel balance or future HTLCs), which guarantees that the fee credit eventually converges to 0.
Add a parameter to our liquidity policy to limit the amount that can be allocated to fee credit. We don't want a temporary high feerate to cause wallet users to allocate too much funds towards their fee credit, which they may not use later.
If our balance, combined with our fee credit, doesn't allow us to pay the liquidity fees with the payment type we chose, we immediately abort the splice.
5d21e08 to
9faa2dd
Compare
pm47
approved these changes
Sep 25, 2024
pm47
added a commit
that referenced
this pull request
Sep 27, 2024
* enable feature FundingFeeCredit * emit a liquidity event for each liquidity purchase Independently of whether the purchase was triggered by an on-chain or off-chain payment. Also renamed `LiquidityEvents.Accepted` to `LiquidityEvents.Purchased`. * expose serviceFee in InboundLiquidityOutgoingPayment * add events PaymentEvents.PaymentSent
pm47
added a commit
to ACINQ/phoenixd
that referenced
this pull request
Oct 3, 2024
Adds support for liquidity-ads based protocol for on-the-fly liquidity as specified in lightning/blips#36 and lightning/blips#41, implemented respectively in ACINQ/lightning-kmp#649 and ACINQ/lightning-kmp#660. ### Lightning-kmp update Phoenixd now uses the main branch of `lightning-kmp` (v1.8.0). ### Database update - `LiquidityAds.Lease` is replaced by `LiquidityAds.Purchase`, so we need to update the liquidity table. - the `receivedWith` data have been updated in lightning-kmp, and we need a new `Part.Htlc.V1` object that may contain a `LiquidityAds.FundingFee`. With the `Lease->Purchase` change, we've updated our pattern for versioning database objects. We now have `asDb()` & `asCanonical()` mapping methods and store the type of the db object inside the json (which means we don't need the `type` column anymore, except for convenience). --------- Co-authored-by: pm47 <pm.padiou@gmail.com>
vincenzopalazzo
pushed a commit
to vincenzopalazzo/phoenixd
that referenced
this pull request
Nov 7, 2024
Adds support for liquidity-ads based protocol for on-the-fly liquidity as specified in lightning/blips#36 and lightning/blips#41, implemented respectively in ACINQ/lightning-kmp#649 and ACINQ/lightning-kmp#660. ### Lightning-kmp update Phoenixd now uses the main branch of `lightning-kmp` (v1.8.0). ### Database update - `LiquidityAds.Lease` is replaced by `LiquidityAds.Purchase`, so we need to update the liquidity table. - the `receivedWith` data have been updated in lightning-kmp, and we need a new `Part.Htlc.V1` object that may contain a `LiquidityAds.FundingFee`. With the `Lease->Purchase` change, we've updated our pattern for versioning database objects. We now have `asDb()` & `asCanonical()` mapping methods and store the type of the db object inside the json (which means we don't need the `type` column anymore, except for convenience). --------- Co-authored-by: pm47 <pm.padiou@gmail.com>
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 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 by paying part of the fees from our fee credit.
This feature makes more efficient use of on-chain transactions by trusting that our peer will honor our fee credit in the future. The fee credit takes precedence over other ways of paying the fees (from our channel balance or future HTLCs), which guarantees that the fee credit eventually converges to 0.