@@ -2373,27 +2373,44 @@ func (l *LightningWallet) ValidateChannel(channelState *channeldb.OpenChannel,
23732373 if err != nil {
23742374 return err
23752375 }
2376- signedCommitTx , err := channel .getSignedCommitTx ()
2377- if err != nil {
2378- return err
2379- }
2376+
2377+ localKey := channelState .LocalChanCfg .MultiSigKey .PubKey
2378+ remoteKey := channelState .RemoteChanCfg .MultiSigKey .PubKey
23802379
23812380 // We'll also need the multi-sig witness script itself so the
23822381 // chanvalidate package can check it for correctness against the
23832382 // funding transaction, and also commitment validity.
2384- localKey := channelState .LocalChanCfg .MultiSigKey .PubKey
2385- remoteKey := channelState .RemoteChanCfg .MultiSigKey .PubKey
2386- witnessScript , err := input .GenMultiSigScript (
2387- localKey .SerializeCompressed (),
2388- remoteKey .SerializeCompressed (),
2389- )
2390- if err != nil {
2391- return err
2383+ var fundingScript []byte
2384+ if channelState .ChanType .IsTaproot () {
2385+ fundingScript , _ , err = input .GenTaprootFundingScript (
2386+ localKey , remoteKey , int64 (channel .Capacity ),
2387+ )
2388+ if err != nil {
2389+ return err
2390+ }
2391+
2392+ } else {
2393+ witnessScript , err := input .GenMultiSigScript (
2394+ localKey .SerializeCompressed (),
2395+ remoteKey .SerializeCompressed (),
2396+ )
2397+ if err != nil {
2398+ return err
2399+ }
2400+ fundingScript , err = input .WitnessScriptHash (witnessScript )
2401+ if err != nil {
2402+ return err
2403+ }
23922404 }
2393- pkScript , err := input .WitnessScriptHash (witnessScript )
2405+
2406+ signedCommitTx , err := channel .getSignedCommitTx ()
23942407 if err != nil {
23952408 return err
23962409 }
2410+ commitCtx := & chanvalidate.CommitmentContext {
2411+ Value : channel .Capacity ,
2412+ FullySignedCommitTx : signedCommitTx ,
2413+ }
23972414
23982415 // Finally, we'll pass in all the necessary context needed to fully
23992416 // validate that this channel is indeed what we expect, and can be
@@ -2402,12 +2419,9 @@ func (l *LightningWallet) ValidateChannel(channelState *channeldb.OpenChannel,
24022419 Locator : & chanvalidate.OutPointChanLocator {
24032420 ChanPoint : channelState .FundingOutpoint ,
24042421 },
2405- MultiSigPkScript : pkScript ,
2422+ MultiSigPkScript : fundingScript ,
24062423 FundingTx : fundingTx ,
2407- CommitCtx : & chanvalidate.CommitmentContext {
2408- Value : channel .Capacity ,
2409- FullySignedCommitTx : signedCommitTx ,
2410- },
2424+ CommitCtx : commitCtx ,
24112425 })
24122426 if err != nil {
24132427 return err
0 commit comments