55
66 "github.com/btcsuite/btcd/btcec/v2"
77 "github.com/btcsuite/btcd/btcutil"
8+ "github.com/btcsuite/btcd/chaincfg/chainhash"
89 "github.com/btcsuite/btcd/wire"
10+ "github.com/lightningnetwork/lnd/fn"
911 "github.com/lightningnetwork/lnd/input"
1012 "github.com/lightningnetwork/lnd/keychain"
1113)
@@ -56,6 +58,14 @@ type ShimIntent struct {
5658 // generate an aggregate key to use as the taproot-native multi-sig
5759 // output.
5860 musig2 bool
61+
62+ // tapscriptRoot is the root of the tapscript tree that will be used to
63+ // create the funding output. This field will only be utilized if the
64+ // MuSig2 flag above is set to true.
65+ //
66+ // TODO(roasbeef): fold above into new chan type? sum type like thing,
67+ // includes the tapscript root, etc
68+ tapscriptRoot fn.Option [chainhash.Hash ]
5969}
6070
6171// FundingOutput returns the witness script, and the output that creates the
@@ -73,12 +83,18 @@ func (s *ShimIntent) FundingOutput() ([]byte, *wire.TxOut, error) {
7383 // If musig2 is active, then we'll return a single aggregated key
7484 // rather than using the "existing" funding script.
7585 if s .musig2 {
86+ var scriptOpts []input.FundingScriptOpt
87+ s .tapscriptRoot .WhenSome (func (root chainhash.Hash ) {
88+ scriptOpts = append (
89+ scriptOpts , input .WithTapscriptRoot (root ),
90+ )
91+ })
92+
7693 // Similar to the existing p2wsh script, we'll always ensure
7794 // the keys are sorted before use.
7895 return input .GenTaprootFundingScript (
79- s .localKey .PubKey ,
80- s .remoteKey ,
81- int64 (totalAmt ),
96+ s .localKey .PubKey , s .remoteKey , int64 (totalAmt ),
97+ scriptOpts ... ,
8298 )
8399 }
84100
0 commit comments