-
Notifications
You must be signed in to change notification settings - Fork 2.3k
multi: add initial implementation of simple taproot chans spec proposal #6877
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
Closed
Closed
Changes from 39 commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
37148b6
lnwire: add new Musig2Nonce type for signing+verification musig nonces
Roasbeef 8fd7459
lnwire: add musig2 nonces to open_channel msg
Roasbeef f61db68
lnwire: add musig2 nonces to accept_channel msg
Roasbeef 4c15c28
lnwire: add musig2 nonces to funding_locked msg
Roasbeef 4ffadd3
lnwire: add musig2 nonces to chan_reest msg
Roasbeef 82bb765
lnwire: add musig2 nonces to closing_signed
Roasbeef fbf4a8e
lnwire: add musig2 nonces to commit_sig
Roasbeef 0ccaaa0
lnwire: add musig2 nonces to revoke_and_ack
Roasbeef cbe0a9c
lnwire: add musig2 nonces to shutdown
Roasbeef 090cf52
lnwire: add feature bits for simple-taproot-chans
Roasbeef 4ffec3c
lnwire: always sort records in ExtractRecords
Roasbeef 15552f7
feature: define default set and deps for simple taproot chans
Roasbeef c45f666
channeldb: add SimpleTaprootFeatureBit chan type
Roasbeef 4fa2372
funding: define accepted feature bit combos for taproot chans
Roasbeef a318d4d
input: thread through musig2.SessionOptions for create session
Roasbeef 75f4a14
input: add GenTaprootFundingScript for musig2 chans
Roasbeef 5d40959
input: add TaprootCommitScriptToSelf for local self balance
Roasbeef b459a81
input: add TaprootCommitScriptToRemote for remote taproot outputs
Roasbeef 9717efd
input: add TaprootOutputKeyAnchor for taproot anchor outputs
Roasbeef cc2fa3c
input: create new PayToTaprootScript utility func
Roasbeef a2cd14b
lnwallet/btcwallet: update musig2 signer to pass in session opts
Roasbeef f0360c9
lnwallet: add new taproot commitment type enum value
Roasbeef ae613fb
lnwallet: add signing+verification musig2 nonces to ChannelContribution
Roasbeef c68e84d
lnwallet: add MusigPartialSig wrapper over musig2.PartialSignature
Roasbeef fd58579
lnwallet: add MusigSession struct to encapsulate taproot commit updat…
Roasbeef 05a8469
lnwallet: add MusigPairSession to handle asymmetric commitment states
Roasbeef b9a8400
lnwallet/chanfunding: update the funding assemblers to make musig2 fu…
Roasbeef e831860
lnwallet: add the pre-tweak CombinedFundingKey to CommitmentKeyRing
Roasbeef 92b3a43
lnwallet: update CommitScriptToSelf to conditionally make P2TR outputs
Roasbeef d51facd
lnwallet: update CommitScriptToRemote to conditionally make P2TR outputs
Roasbeef d6eeda2
lnwallet: update CommitScriptAnchors to conditionally make P2TR outputs
Roasbeef a8554f4
lnwallet: create signing+verification nonces for taproot channel funding
Roasbeef 1b121a3
funding: send signing+verification nonces in open/accept channel for …
Roasbeef ac82dd8
lnwallet: pass thru musig2 context for chan funder requests
Roasbeef 505c190
lnwallet: add internal funding support for signing+verifying musig2 c…
Roasbeef 1c9efdd
lnwallet: add new test case for musig2 single funder workflows
Roasbeef 710e76a
lnwallet: add initial awareness for musig2 sessions to channel state …
Roasbeef 7fe9929
lnwallet: update RemoteNextRevocation to return nil if no nonces know…
Roasbeef d3cb968
lnwallet: add initial support for musig2 handling for commitment dance
Roasbeef 33f3b44
input: fix taproot local/remote scripts
Roasbeef bb085b0
lnwallet: use tweaked keys for taproot anchor outputs
Roasbeef 2b93228
lnwallet: introduce new CommitSigs struct for sign/recv commit
Roasbeef ffe0b5c
input: add tapleaf+control block logic for sender HTLC scripts
Roasbeef b285a58
input: add tapleaf+ctrlblock logic for receiver HTLC scripts
Roasbeef 6b22b0f
input: add new taproot second level HTLC scripts+txns
Roasbeef c884b4e
build: update to musig2 1.0
Roasbeef a7dca6b
lnwallet+input: move mock signer into lnwallet pkg, use new musig ses…
Roasbeef 1797ace
multi: morph existing lnwire.SIg into new struct to support schnorr+e…
Roasbeef 10e27ac
lnwallet: update funding nonce gen to pass in priv key
Roasbeef cc18427
lnwallet: parse incoming schnorr signature as "schnorr shell"
Roasbeef 514254d
lnwallet: update ValidateChannel to recognize musig2+taproot chans
Roasbeef 038954b
lnwallet: update CreateHtlcTimeoutTx+CreateHtlcSuccessTx for musig2+t…
Roasbeef 8466ae0
lnwallet/btcwallet/signer: fix SignOutputRaw bug w/ non-default sighash
Roasbeef 13fea73
lnwallet: properly pass in remoteCommit into NewMusigSession
Roasbeef 950b83e
lnwallet: add temp methods for going to/from musig2 schnorr shell sigs
Roasbeef d28fe84
lnwallet: pass in pubkey for nonce gen in musig2.SignCommit
Roasbeef d443039
lnwallet: modify MusigSession.Refresh to return new instance instead …
Roasbeef 391c176
lnwallet; update musig2.VerifyCommitSig to pubkey nonce and set prope…
Roasbeef d1eb662
lnwallet: add MusigSession.CombineSigs method
Roasbeef 0689779
lnwallet: use input.Signature rather than raw sig pointers
Roasbeef 9c4ff67
contractcourt: update the chainWatcher to recognize taproot+musig2 fu…
Roasbeef ef8ca2d
funding: send nonces along side open+accept channel
Roasbeef 76e49f5
funding: update makeFundingScript for musig2 chans
Roasbeef c9d0f42
funding: send musig2 nonces w/ funding_locked, add recv processing logic
Roasbeef 49bd2a4
funding: reject funding attempts for public taproot channels
Roasbeef 9463eea
funding: add the taproot feature bit for funding announcements
Roasbeef 67e0535
routing: update chan validate logic to recognize musig2 channels
Roasbeef b4b8157
lnwallet: add IsTaproot method to ChannelReservation
Roasbeef 8aa81f8
lnwallet: update CommitScriptToRemote to properly set taproot script
Roasbeef 1646d7c
lnwallet: update genHtlcScript to dispense taproot HTLC scripts
Roasbeef afd9e5c
lnwallet: update NewLightningChannel with new musig2 opts
Roasbeef 3b27533
lnwallet: update sig pool to support signing+verifying 2nd level tapr…
Roasbeef 15f0565
lnwallet: update channel state machine dance to support new musig2 flow
Roasbeef 90194af
lnwallet: add new public NewMusigChannelNonces method, use pubkey for…
Roasbeef f9da9a4
lnwallet: add new co-op close opts for providing musig2 session for t…
Roasbeef 464e009
lnwallet: add taproot case to testAddSettleWorkflow
Roasbeef ab91106
peer+lnpeer: add new wrapper struct to allow passing opaque opts to c…
Roasbeef 7643be5
htlcswitch: pass along new musig2 nonce information to link
Roasbeef a370180
htlcswitch: send new nonces in chan reest message, add recv logic
Roasbeef f585b9c
lnwallet/chancloser: add support for musig2 co-op closes w/ auto accept
Roasbeef 5e68ba8
rpc: add support for parsing musig2 openchannel requests
Roasbeef 0a18d3e
cmd/lncli: add taproot chan parsing support for openchannel
Roasbeef 5ba9ed5
multi: switch to using new partial_sig TLV type for musig sigs
Roasbeef dedd31d
multi: use distinct types for sig + nonce used in co-op close flow
Roasbeef e68221c
multi: use counter based (shachain) nonces for all local nonces
Roasbeef e69ffe8
lnwire: fix bug with PartialSigWithNonce.Decode/Encode
Roasbeef ded917b
multi: add initial support for force closing
Roasbeef 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
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
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 |
|---|---|---|
|
|
@@ -1659,6 +1659,21 @@ func (f *Manager) handleFundingOpen(peer lnpeer.Peer, | |
| log.Debugf("Remote party accepted commitment constraints: %v", | ||
| spew.Sdump(remoteContribution.ChannelConfig.ChannelConstraints)) | ||
|
|
||
| ourContribution := reservation.OurContribution() | ||
|
|
||
| var ( | ||
| localNonce *lnwire.LocalMusig2Nonce | ||
| remoteNonce *lnwire.RemoteMusig2Nonce | ||
| ) | ||
| if commitType == lnwallet.CommitmentTypeSimpleTaproot { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can use |
||
| localNonce = &lnwire.LocalMusig2Nonce{ | ||
| Musig2Nonce: ourContribution.LocalNonce.PubNonce, | ||
| } | ||
| remoteNonce = &lnwire.RemoteMusig2Nonce{ | ||
| Musig2Nonce: ourContribution.RemoteNonce.PubNonce, | ||
| } | ||
| } | ||
|
|
||
| // With the initiator's contribution recorded, respond with our | ||
| // contribution in the next message of the workflow. | ||
| ourContribution := reservation.OurContribution() | ||
|
|
@@ -1680,6 +1695,8 @@ func (f *Manager) handleFundingOpen(peer lnpeer.Peer, | |
| UpfrontShutdownScript: ourContribution.UpfrontShutdown, | ||
| ChannelType: chanTypeFeatureBits, | ||
| LeaseExpiry: msg.LeaseExpiry, | ||
| LocalNonce: localNonce, | ||
| RemoteNonce: remoteNonce, | ||
| } | ||
|
|
||
| if err := peer.SendMessage(true, &fundingAccept); err != nil { | ||
|
|
@@ -4037,6 +4054,19 @@ func (f *Manager) handleInitFundingMsg(msg *InitFundingMsg) { | |
| log.Infof("Starting funding workflow with %v for pending_id(%x), "+ | ||
| "committype=%v", msg.Peer.Address(), chanID, commitType) | ||
|
|
||
| var ( | ||
| localNonce *lnwire.LocalMusig2Nonce | ||
| remoteNonce *lnwire.RemoteMusig2Nonce | ||
| ) | ||
| if commitType == lnwallet.CommitmentTypeSimpleTaproot { | ||
| localNonce = &lnwire.LocalMusig2Nonce{ | ||
| Musig2Nonce: ourContribution.LocalNonce.PubNonce, | ||
| } | ||
| remoteNonce = &lnwire.RemoteMusig2Nonce{ | ||
| Musig2Nonce: ourContribution.RemoteNonce.PubNonce, | ||
| } | ||
| } | ||
|
|
||
| fundingOpen := lnwire.OpenChannel{ | ||
| ChainHash: *f.cfg.Wallet.Cfg.NetParams.GenesisHash, | ||
| PendingChannelID: chanID, | ||
|
|
@@ -4059,6 +4089,8 @@ func (f *Manager) handleInitFundingMsg(msg *InitFundingMsg) { | |
| UpfrontShutdownScript: shutdown, | ||
| ChannelType: chanType, | ||
| LeaseExpiry: leaseExpiry, | ||
| LocalNonce: localNonce, | ||
| RemoteNonce: remoteNonce, | ||
| } | ||
| if err := msg.Peer.SendMessage(true, &fundingOpen); err != nil { | ||
| e := fmt.Errorf("unable to send funding request message: %v", | ||
|
|
||
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.
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.
should anchors be a dependency?