@@ -10,6 +10,7 @@ import (
1010 "sync/atomic"
1111 "time"
1212
13+ "github.com/btcsuite/btcd/btcec/v2/schnorr/musig2"
1314 "github.com/btcsuite/btcd/btcutil"
1415 "github.com/btcsuite/btcd/wire"
1516 "github.com/btcsuite/btclog"
@@ -699,6 +700,21 @@ func (l *channelLink) syncChanStates() error {
699700 "ChannelPoint(%v)" , l .channel .ChannelPoint ())
700701 }
701702
703+ // If this is a tarpoot channel, then in addition to the normal reest
704+ // message, we'll also send our local+remote nonces as well.
705+ //
706+ // TODO(roasbeef): move into ChanSyncMsg
707+ if chanState .ChanType .IsTaproot () {
708+ localNonce , err := l .channel .GenMusigNonces ()
709+ if err != nil {
710+ return fmt .Errorf ("unable to generate nonce " +
711+ "pair for chan: %w" , err )
712+ }
713+ localChanSyncMsg .LocalNonce = (* lnwire .Musig2Nonce )(
714+ & localNonce .PubNonce ,
715+ )
716+ }
717+
702718 if err := l .cfg .Peer .SendMessage (true , localChanSyncMsg ); err != nil {
703719 return fmt .Errorf ("unable to send chan sync message for " +
704720 "ChannelPoint(%v): %v" , l .channel .ChannelPoint (), err )
@@ -766,6 +782,22 @@ func (l *channelLink) syncChanStates() error {
766782 }
767783 }
768784
785+ // Before we process the ChanSync message, if this is a taproot
786+ // channel, then we'll init our musig2 nonces state.
787+ if chanState .ChanType .IsTaproot () {
788+ l .log .Infof ("initializing musig2 nonces" )
789+
790+ syncMsg := remoteChanSyncMsg
791+ remoteNonce := & musig2.Nonces {
792+ PubNonce : * syncMsg .LocalNonce ,
793+ }
794+ err := l .channel .InitRemoteMusigNonces (remoteNonce )
795+ if err != nil {
796+ return fmt .Errorf ("unable to init musig2 " +
797+ "nonces: %w" , err )
798+ }
799+ }
800+
769801 // In any case, we'll then process their ChanSync message.
770802 l .log .Info ("received re-establishment message from remote side" )
771803
@@ -1932,6 +1964,7 @@ func (l *channelLink) handleUpstreamMsg(msg lnwire.Message) {
19321964 err = l .channel .ReceiveNewCommitment (& lnwallet.CommitSigs {
19331965 CommitSig : msg .CommitSig ,
19341966 HtlcSigs : msg .HtlcSigs ,
1967+ PartialSig : msg .PartialSig ,
19351968 })
19361969 if err != nil {
19371970 // If we were unable to reconstruct their proposed
@@ -2312,6 +2345,7 @@ func (l *channelLink) updateCommitTx() error {
23122345 ChanID : l .ChanID (),
23132346 CommitSig : newCommit .CommitSig ,
23142347 HtlcSigs : newCommit .HtlcSigs ,
2348+ PartialSig : newCommit .PartialSig ,
23152349 }
23162350 l .cfg .Peer .SendMessage (false , commitSig )
23172351
0 commit comments