-
Notifications
You must be signed in to change notification settings - Fork 27
Improve swap-in protocol with taproot and musig2 #563
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
Merged
Merged
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
24ed675
Move swap-in related methods into their own class
sstone 7054f5f
Add an example of swapin transaction that uses musig2 and taproot
sstone e6c9038
Add a RemoteSwapInV2 message
sstone d097480
Add musig2-based swap-in protocol
sstone af9b0d7
Use different user keys for the common and refund paths
sstone 54988f9
Rename PartialSignature.nonce to aggregatedPublicNonce
sstone bd2690b
Add a musig2 secret nonce field to local/remote musing2 swap-in classes
sstone 28b69ba
Rework TxComplete to use implicit ordering for musig2 nonces
sstone 626aeca
Revert to using a map to store musig2 secret nonces
sstone 2f295bb
Upgrade bitcoin-kmp
sstone 6909368
Apply latest bitcoin-kmp musig2 changes
sstone 89d3956
Fix serialization of swap-in parameters
sstone c485329
Rename legacy swap-in protocol
sstone 339cd73
Update musig2 api
sstone 0c0c7dc
Address review comments
sstone 7f7f9af
Export a descriptor for swap-in recovery
sstone 5bab5d5
Do not send the previous tx for swap-in inputs
sstone 7bfd022
Update snapshot publishing script
sstone 1ec236d
Update to latest changes in bitcoin-kmp (error handling)
sstone 4b04f5f
Revert "Do not send the previous tx for swap-in inputs"
sstone 9871f48
Update to latest bitcoin-kmp changes
sstone 2b4ad8d
Use musig2 helpers to simplify swap-in protocol (#592)
t-bast 7578574
Restore ignored tests
sstone f7c8b07
Update interactive tx tests to use the new swap-in protocol
sstone c215ad4
Add link to recovery procedure for older wallets
sstone f963c21
Fix failing splice tests
sstone 7d17663
Rework recovery procedure
sstone bf2f7b0
Use released versions of secp256k1-kmp and bitcoin-kmp
sstone 335e4c2
Set version to 1.6-SNAPSHOT
sstone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
340 changes: 279 additions & 61 deletions
340
src/commonMain/kotlin/fr/acinq/lightning/channel/InteractiveTx.kt
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,7 +107,7 @@ data class WaitForFundingConfirmed( | |
addAll(latestFundingTx.sharedTx.tx.localInputs.map { Either.Left(it) }) | ||
addAll(latestFundingTx.sharedTx.tx.localOutputs.map { Either.Right(it) }) | ||
} | ||
val session = InteractiveTxSession(channelKeys(), keyManager.swapInOnChainWallet, fundingParams, SharedFundingInputBalances(0.msat, 0.msat, 0.msat), toSend, previousFundingTxs.map { it.sharedTx }, commitments.latest.localCommit.spec.htlcs) | ||
val session = InteractiveTxSession(staticParams.remoteNodeId, channelKeys(), keyManager.swapInOnChainWallet, fundingParams, SharedFundingInputBalances(0.msat, 0.msat, 0.msat), toSend, previousFundingTxs.map { it.sharedTx }, commitments.latest.localCommit.spec.htlcs) | ||
val nextState = [email protected](rbfStatus = RbfStatus.InProgress(session)) | ||
Pair(nextState, listOf(ChannelAction.Message.Send(TxAckRbf(channelId, fundingParams.localContribution)))) | ||
} | ||
|
@@ -142,7 +142,7 @@ data class WaitForFundingConfirmed( | |
Pair([email protected](rbfStatus = RbfStatus.RbfAborted), listOf(ChannelAction.Message.Send(TxAbort(channelId, ChannelFundingError(channelId).message)))) | ||
} | ||
is Either.Right -> { | ||
val (session, action) = InteractiveTxSession(channelKeys(), keyManager.swapInOnChainWallet, fundingParams, 0.msat, 0.msat, emptySet(), contributions.value, previousFundingTxs.map { it.sharedTx }).send() | ||
val (session, action) = InteractiveTxSession(staticParams.remoteNodeId, channelKeys(), keyManager.swapInOnChainWallet, fundingParams, 0.msat, 0.msat, emptySet(), contributions.value, previousFundingTxs.map { it.sharedTx }).send() | ||
when (action) { | ||
is InteractiveTxSessionAction.SendMessage -> { | ||
val nextState = [email protected](rbfStatus = RbfStatus.InProgress(session)) | ||
|
@@ -169,6 +169,7 @@ data class WaitForFundingConfirmed( | |
is InteractiveTxSessionAction.SignSharedTx -> { | ||
val replacedCommitment = commitments.latest | ||
val signingSession = InteractiveTxSigningSession.create( | ||
rbfSession1, | ||
keyManager, | ||
commitments.params, | ||
rbfSession1.fundingParams, | ||
|
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.