@@ -2362,27 +2362,44 @@ func (l *LightningWallet) ValidateChannel(channelState *channeldb.OpenChannel,
23622362 if err != nil {
23632363 return err
23642364 }
2365- signedCommitTx , err := channel .getSignedCommitTx ()
2366- if err != nil {
2367- return err
2368- }
2365+
2366+ localKey := channelState .LocalChanCfg .MultiSigKey .PubKey
2367+ remoteKey := channelState .RemoteChanCfg .MultiSigKey .PubKey
23692368
23702369 // We'll also need the multi-sig witness script itself so the
23712370 // chanvalidate package can check it for correctness against the
23722371 // funding transaction, and also commitment validity.
2373- localKey := channelState .LocalChanCfg .MultiSigKey .PubKey
2374- remoteKey := channelState .RemoteChanCfg .MultiSigKey .PubKey
2375- witnessScript , err := input .GenMultiSigScript (
2376- localKey .SerializeCompressed (),
2377- remoteKey .SerializeCompressed (),
2378- )
2379- if err != nil {
2380- return err
2372+ var fundingScript []byte
2373+ if channelState .ChanType .IsTaproot () {
2374+ fundingScript , _ , err = input .GenTaprootFundingScript (
2375+ localKey , remoteKey , int64 (channel .Capacity ),
2376+ )
2377+ if err != nil {
2378+ return err
2379+ }
2380+
2381+ } else {
2382+ witnessScript , err := input .GenMultiSigScript (
2383+ localKey .SerializeCompressed (),
2384+ remoteKey .SerializeCompressed (),
2385+ )
2386+ if err != nil {
2387+ return err
2388+ }
2389+ fundingScript , err = input .WitnessScriptHash (witnessScript )
2390+ if err != nil {
2391+ return err
2392+ }
23812393 }
2382- pkScript , err := input .WitnessScriptHash (witnessScript )
2394+
2395+ signedCommitTx , err := channel .getSignedCommitTx ()
23832396 if err != nil {
23842397 return err
23852398 }
2399+ commitCtx := & chanvalidate.CommitmentContext {
2400+ Value : channel .Capacity ,
2401+ FullySignedCommitTx : signedCommitTx ,
2402+ }
23862403
23872404 // Finally, we'll pass in all the necessary context needed to fully
23882405 // validate that this channel is indeed what we expect, and can be
@@ -2391,12 +2408,9 @@ func (l *LightningWallet) ValidateChannel(channelState *channeldb.OpenChannel,
23912408 Locator : & chanvalidate.OutPointChanLocator {
23922409 ChanPoint : channelState .FundingOutpoint ,
23932410 },
2394- MultiSigPkScript : pkScript ,
2411+ MultiSigPkScript : fundingScript ,
23952412 FundingTx : fundingTx ,
2396- CommitCtx : & chanvalidate.CommitmentContext {
2397- Value : channel .Capacity ,
2398- FullySignedCommitTx : signedCommitTx ,
2399- },
2413+ CommitCtx : commitCtx ,
24002414 })
24012415 if err != nil {
24022416 return err
0 commit comments