-
Notifications
You must be signed in to change notification settings - Fork 266
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
Implement on-the-fly funding based on splicing and liquidity ads #2861
Commits on Sep 24, 2024
-
Add
on_the_fly_funding
feature bit and messagesAdd the (disabled by default) `on_the_fly_funding` feature bit and codecs for the corresponding messages: - `will_add_htlc` - `will_fail_htlc` - `will_fail_malformed_htlc` - `cancel_on_the_fly_funding` We also add a TLV to `update_add_htlc` to notify the recipient that we relayed less data than what the onion encodes, in exchange for the fees of the specified funding transaction.
Configuration menu - View commit details
-
Copy full SHA for e894d8a - Browse repository at this point
Copy the full SHA e894d8aView commit details -
Add
non_initiator_pays_commit_fees
channel flagWe add a non-standard channel flag to `open_channel2` to allow wallets to ask their peer to pay the commit tx fees, even when they're not the channel opener. This is necessary for on-the-fly funding, until we can move to 0-fee commit txs which will make it obsolete.
Configuration menu - View commit details
-
Copy full SHA for e2e21a4 - Browse repository at this point
Copy the full SHA e2e21a4View commit details -
Allow underpaying feerate when using future HTLCs
When an interactive-tx session is created for a liquidity purchase that uses future HTLCs to pay fees, the initiator may not have enough funds to honor the target feerate. We allow the transaction anyway, because we want to get paid for the liquidity we're providing. If the feerate is too low and the transaction doesn't confirm, we can double-spend it if we need that liquidity elsewhere.
Configuration menu - View commit details
-
Copy full SHA for cddf848 - Browse repository at this point
Copy the full SHA cddf848View commit details -
Add
funding_fee
field toCMD_ADD_HTLC
This commit adds the funding fee field to HTLCs, but never sets it. We update a lot of test files, but there is no functional change.
Configuration menu - View commit details
-
Copy full SHA for fa2bf42 - Browse repository at this point
Copy the full SHA fa2bf42View commit details -
Implement the on-the-fly funding protocol: when a payment cannot be relayed because of a liquidity issue, we notify the `Peer` actor that we'd like to trigger on-the-fly funding if available. If available, we we send a funding proposal to our peer and keep track of its status. Once a matching funding transaction is signed, we persist this funding attempt and wait for the additional liquidity to be available (once the channel is ready or the splice locked). We will then frequently try to relay the payment to get paid our liquidity fees. If the payment keeps getting rejected, or we cannot connect to our peer, we abandon the payment when it reaches its CLTV expiry, which ensures that the upstream channels are not at risk. When using on-the-fly funding, we use a single channel with our peer. If they try to open another channel while one is available, we reject their request and expect a splice instead.
Configuration menu - View commit details
-
Copy full SHA for a4a7264 - Browse repository at this point
Copy the full SHA a4a7264View commit details -
Add
requireConfirmedInputs
to non-initiator initSimilar to #2461 but for the non-initiator of a channel open.
Configuration menu - View commit details
-
Copy full SHA for 2fe9265 - Browse repository at this point
Copy the full SHA 2fe9265View commit details -
Don't initiate
on-the-fly-funding
if remote feature not activeWe check the remote features before initiating an on-the-fly funding attempt: it doesn't make sense to initiate it if our peer has not activated the feature.
Configuration menu - View commit details
-
Copy full SHA for 4c4d486 - Browse repository at this point
Copy the full SHA 4c4d486View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7e740e6 - Browse repository at this point
Copy the full SHA 7e740e6View commit details
Commits on Sep 25, 2024
-
Process
CommandResponse
first, settlement nextInstead of handling command responses and settlement in parallel (which is a bit confusing), we stash settlements, process all command responses, and then preocess all settlements. This makes the flow a bit more strict (as modifications to tests show), but it's easier to follow what the fsm does.
Configuration menu - View commit details
-
Copy full SHA for 8938451 - Browse repository at this point
Copy the full SHA 8938451View commit details