@@ -16,6 +16,7 @@ import (
1616 "github.com/lightningnetwork/lnd/keychain"
1717 "github.com/lightningnetwork/lnd/lnwallet/chanfunding"
1818 "github.com/lightningnetwork/lnd/lnwire"
19+ "github.com/lightningnetwork/lnd/tlv"
1920)
2021
2122// CommitmentType is an enum indicating the commitment type we should use for
@@ -213,16 +214,16 @@ type ChannelReservation struct {
213214 // commitment state.
214215 pushMSat lnwire.MilliSatoshi
215216
216- // tapscriptRoot is the root of the tapscript tree that will be used to
217- // create the musig2 funding output. This is only used for taproot
218- // channels.
219- tapscriptRoot fn.Option [chainhash.Hash ]
220-
221217 wallet * LightningWallet
222218 chanFunder chanfunding.Assembler
223219
224220 fundingIntent chanfunding.Intent
225221
222+ // initAuxLeaves is an optional set of aux commitment leaves that'll
223+ // modify the way we construct the commitment transaction, in
224+ // particular the tapscript leaves.
225+ initAuxLeaves fn.Option [CommitAuxLeaves ]
226+
226227 // nextRevocationKeyLoc stores the key locator information for this
227228 // channel.
228229 nextRevocationKeyLoc keychain.KeyLocator
@@ -418,7 +419,7 @@ func NewChannelReservation(capacity, localFundingAmt btcutil.Amount,
418419 chanType |= channeldb .ScidAliasFeatureBit
419420 }
420421
421- if req .TapscriptRoot .IsSome () {
422+ if req .AuxFundingDesc .IsSome () {
422423 chanType |= channeldb .TapscriptRootBit
423424 }
424425
@@ -443,25 +444,39 @@ func NewChannelReservation(capacity, localFundingAmt btcutil.Amount,
443444 RemoteBalance : theirBalance ,
444445 FeePerKw : btcutil .Amount (req .CommitFeePerKw ),
445446 CommitFee : commitFee ,
447+ CustomBlob : fn .MapOption (func (desc AuxFundingDesc ) tlv.Blob {
448+ return desc .CustomLocalCommitBlob
449+ })(req .AuxFundingDesc ),
446450 },
447451 RemoteCommitment : channeldb.ChannelCommitment {
448452 LocalBalance : ourBalance ,
449453 RemoteBalance : theirBalance ,
450454 FeePerKw : btcutil .Amount (req .CommitFeePerKw ),
451455 CommitFee : commitFee ,
456+ CustomBlob : fn .MapOption (func (desc AuxFundingDesc ) tlv.Blob {
457+ return desc .CustomRemoteCommitBlob
458+ })(req .AuxFundingDesc ),
452459 },
453460 ThawHeight : thawHeight ,
454461 Db : wallet .Cfg .Database ,
455462 InitialLocalBalance : ourBalance ,
456463 InitialRemoteBalance : theirBalance ,
457464 Memo : req .Memo ,
458- TapscriptRoot : req .TapscriptRoot ,
465+ CustomBlob : fn .MapOption (func (desc AuxFundingDesc ) tlv.Blob {
466+ return desc .CustomFundingBlob
467+ })(req .AuxFundingDesc ),
468+ TapscriptRoot : fn .MapOption (func (desc AuxFundingDesc ) chainhash.Hash {
469+ return desc .TapscriptRoot
470+ })(req .AuxFundingDesc ),
459471 },
460472 pushMSat : req .PushMSat ,
461473 pendingChanID : req .PendingChanID ,
462474 reservationID : id ,
463475 wallet : wallet ,
464476 chanFunder : req .ChanFunder ,
477+ initAuxLeaves : fn .MapOption (func (desc AuxFundingDesc ) CommitAuxLeaves {
478+ return desc .InitAuxLeaves
479+ })(req .AuxFundingDesc ),
465480 }, nil
466481}
467482
0 commit comments