-
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
Add support for splices #430
Conversation
src/commonMain/kotlin/fr/acinq/lightning/channel/ChannelData.kt
Outdated
Show resolved
Hide resolved
src/commonMain/kotlin/fr/acinq/lightning/wire/LightningMessages.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I focused on the first commits that implement the splice protocol, without looking at the interaction with payments: can we separate this to another PR? I believe that all the commits starting at a15eac1 can be extracted to another future PR to allow merging the splice protocol to master
early, as it doesn't have any negative impact on the rest of the codebase.
src/commonMain/kotlin/fr/acinq/lightning/channel/Commitments.kt
Outdated
Show resolved
Hide resolved
src/commonMain/kotlin/fr/acinq/lightning/channel/Commitments.kt
Outdated
Show resolved
Hide resolved
src/commonTest/kotlin/fr/acinq/lightning/channel/states/SpliceTestsCommon.kt
Outdated
Show resolved
Hide resolved
Replace `makeFirstCommitTxs` by `makeCommitTxsWithoutHtlcs` which generates a pair of commitments for arbitrary `fundingTxIndex` and `commitmentIndex`.
We introduce a new model for channel commands, that allows for better typing, and is suitable with `replyTo` pattern.
An important side-effect is that we do not eagerly prune initial funding txs as soon as one of the rbf confirms. We could, but it is better to be consistent with the splice case, where we must wait for the counterparty to send their `splice_locked` before pruning.
We still use the `fundingTxId` internally.
- if we have a channel in `Normal`, we use it - if we have no channels, or if none of them will ever be suitable for splice, we request a new channel - in all other cases we do nothing and wait
To compute the remote reserve, we discard the local contribution. It's okay if they go below reserve because we added capacity to the channel with a splice-in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good, I have added fixups and tests in #438
- add comments in complex parts of the code - match whole outpoint instead of just txid when possible - rename `Splice.Response.Success` to `Splice.Response.Created` - send `splice_locked` in the non-zero-conf case - correctly overwrite splice status when disconnecting - add tests
🥁 🥁 🥁 |
Most commits are preparatory or intermediate steps, most of the work happens in:
Tests based on flows in https://gist.github.com/t-bast/1ac31f4e27734a10c5b9847d06db8d86 need to be added.