-
Notifications
You must be signed in to change notification settings - Fork 27
Implement Simple Taproot Channels #805
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
Conversation
c844b52 to
4a306f1
Compare
64fc2b7 to
8134ed7
Compare
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.
That doesn't look too bad, it's simpler than in eclair. I've focused on the topics you were requesting feedback on for this first pass, but otherwise the rest looks pretty good. Once those comments are addressed I think we can import the remaining unit tests from eclair, add e2e tests with eclair, and we should be ready to move forward with it!
modules/core/src/commonMain/kotlin/fr/acinq/lightning/channel/ChannelException.kt
Show resolved
Hide resolved
modules/core/src/commonMain/kotlin/fr/acinq/lightning/crypto/NonceGenerator.kt
Outdated
Show resolved
Hide resolved
modules/core/src/commonMain/kotlin/fr/acinq/lightning/wire/ChannelTlv.kt
Show resolved
Hide resolved
modules/core/src/commonMain/kotlin/fr/acinq/lightning/wire/ChannelTlv.kt
Outdated
Show resolved
Hide resolved
modules/core/src/commonMain/kotlin/fr/acinq/lightning/io/Peer.kt
Outdated
Show resolved
Hide resolved
modules/core/src/commonMain/kotlin/fr/acinq/lightning/io/Peer.kt
Outdated
Show resolved
Hide resolved
modules/core/src/commonMain/kotlin/fr/acinq/lightning/channel/Commitments.kt
Outdated
Show resolved
Hide resolved
modules/core/src/commonMain/kotlin/fr/acinq/lightning/channel/InteractiveTx.kt
Outdated
Show resolved
Hide resolved
modules/core/src/commonMain/kotlin/fr/acinq/lightning/channel/InteractiveTx.kt
Outdated
Show resolved
Hide resolved
1a582e3 to
ae677ee
Compare
This matches changes done on Eclair, and adds support for taproot channels (including splices) with the same TLV extensions. Support for signing commit tx with alternative feerates is not implemented.
ae677ee to
8de4883
Compare
* Always use Taproot channel type It was missing in several cases, and the `OpenChannel` command allowed using other channel types. * nit: refactor scripts and transactions * Refactor commitments We refactor `Commitments.kt` to better match `eclair` and clean up pattern matching (use exhaustive, future-proof pattern matching). We also remove alternative feerate sigs, which aren't necessary anymore since we can now use package relay. The ACINQ node will stop sending `update_fee` and will keep the commitment feerate at `1 sat/byte`. * Refactor `interactive-tx` management Error handling was missing from a few places (incorrectly assuming that nonces were already provided and signature couldn't fail). We also use exhaustive pattern matching everywhere, and clean-up the nonces and funding tx index parameters. We also revert some formatting nits, which make the file inconsistent. * Fix closing RBF nonce management The nonce management was incomplete for mutual close RBF (see changes to `Negotiating.kt`). We must add unit tests to catch those bugs. Mutual close was also not working properly because `revoke_and_ack` nonces weren't taken into account in the `ShuttingDown` state. We also refactor the nonce fields in the various channel states, in which some nonces where unnecessary (e.g. already contained in the `shutdown` message). We make the ordering of fields consistent: `remoteNextCommitNonces` always comes right after `commitments`, since it should always be filled (for taproot channels) and is necessary to update the `commitments`. * Switch tests to taproot channel type We switch almost all existing tests to use the taproot channel type. We fix a few bugs found by the existing test suite: - preimage extraction from HTLC transactions was missing - channel_ready didn't contain local commit nonces - channel_reestablish nonces had an off-by-one in the commit index
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.
LGTM, I'll add more tests in a follow-up PR!
This is the companion PR to ACINQ/eclair#3103.
It includes support for splicing, including upgrading to taproot channels: