@@ -6,11 +6,13 @@ import (
66 "sync"
77
88 "github.com/btcsuite/btcd/btcec/v2"
9+ "github.com/btcsuite/btcd/btcec/v2/schnorr"
910 "github.com/btcsuite/btcd/btcutil"
1011 "github.com/btcsuite/btcd/btcutil/psbt"
1112 "github.com/btcsuite/btcd/chaincfg"
1213 "github.com/btcsuite/btcd/txscript"
1314 "github.com/btcsuite/btcd/wire"
15+ "github.com/lightningnetwork/lnd/fn"
1416 "github.com/lightningnetwork/lnd/input"
1517 "github.com/lightningnetwork/lnd/keychain"
1618)
@@ -208,7 +210,18 @@ func (i *PsbtIntent) FundingParams() (btcutil.Address, int64, *psbt.Packet,
208210 }
209211 }
210212 packet .UnsignedTx .TxOut = append (packet .UnsignedTx .TxOut , out )
211- packet .Outputs = append (packet .Outputs , psbt.POutput {})
213+
214+ var pOut psbt.POutput
215+
216+ // If this is a MuSig2 channel, we also need to communicate the internal
217+ // key to the caller. Otherwise, they cannot verify the construction of
218+ // the P2TR output script.
219+ pOut .TaprootInternalKey = fn .MapOptionZ (
220+ i .TaprootInternalKey (), schnorr .SerializePubKey ,
221+ )
222+
223+ packet .Outputs = append (packet .Outputs , pOut )
224+
212225 return addr , out .Value , packet , nil
213226}
214227
0 commit comments