@@ -268,7 +268,6 @@ type fundingReserveCancelMsg struct {
268268type addContributionMsg struct {
269269 pendingFundingID uint64
270270
271- // TODO(roasbeef): Should also carry SPV proofs in we're in SPV mode
272271 contribution * ChannelContribution
273272
274273 // NOTE: In order to avoid deadlocks, this channel MUST be buffered.
@@ -447,8 +446,6 @@ type LightningWallet struct {
447446 quit chan struct {}
448447
449448 wg sync.WaitGroup
450-
451- // TODO(roasbeef): handle wallet lock/unlock
452449}
453450
454451// NewLightningWallet creates/opens and initializes a LightningWallet instance.
@@ -493,7 +490,6 @@ func (l *LightningWallet) Startup() error {
493490 }
494491
495492 l .wg .Add (1 )
496- // TODO(roasbeef): multiple request handlers?
497493 go l .requestHandler ()
498494
499495 return nil
@@ -1447,7 +1443,6 @@ func (l *LightningWallet) initOurContribution(reservation *ChannelReservation,
14471443// transaction via coin selection are freed allowing future reservations to
14481444// include them.
14491445func (l * LightningWallet ) handleFundingCancelRequest (req * fundingReserveCancelMsg ) {
1450- // TODO(roasbeef): holding lock too long
14511446 l .limboMtx .Lock ()
14521447 defer l .limboMtx .Unlock ()
14531448
@@ -1472,11 +1467,6 @@ func (l *LightningWallet) handleFundingCancelRequest(req *fundingReserveCancelMs
14721467 )
14731468 }
14741469
1475- // TODO(roasbeef): is it even worth it to keep track of unused keys?
1476-
1477- // TODO(roasbeef): Is it possible to mark the unused change also as
1478- // available?
1479-
14801470 delete (l .fundingLimbo , req .pendingFundingID )
14811471
14821472 pid := pendingReservation .pendingChanID
@@ -1654,16 +1644,24 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) {
16541644 // and remote key which will be needed to calculate the multisig
16551645 // funding output in a next step.
16561646 pendingChanID := pendingReservation .pendingChanID
1647+
16571648 walletLog .Debugf ("Advancing PSBT funding flow for " +
16581649 "pending_id(%x), binding keys local_key=%v, " +
16591650 "remote_key=%x" , pendingChanID ,
16601651 & ourContribution .MultiSigKey ,
16611652 theirContribution .MultiSigKey .PubKey .SerializeCompressed ())
1653+
16621654 fundingIntent .BindKeys (
16631655 & ourContribution .MultiSigKey ,
16641656 theirContribution .MultiSigKey .PubKey ,
16651657 )
16661658
1659+ // We might have a tapscript root, so we'll bind that now to
1660+ // ensure we make the proper funding output.
1661+ fundingIntent .BindTapscriptRoot (
1662+ pendingReservation .partialState .TapscriptRoot ,
1663+ )
1664+
16671665 // Exit early because we can't continue the funding flow yet.
16681666 req .err <- & PsbtFundingRequired {
16691667 Intent : fundingIntent ,
@@ -1736,16 +1734,17 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) {
17361734// the commitment transaction for the remote party, and verify their incoming
17371735// partial signature.
17381736func genMusigSession (ourContribution , theirContribution * ChannelContribution ,
1739- signer input.MuSig2Signer ,
1740- fundingOutput * wire. TxOut ) * MusigPairSession {
1737+ signer input.MuSig2Signer , fundingOutput * wire. TxOut ,
1738+ tapscriptRoot fn. Option [chainhash. Hash ] ) * MusigPairSession {
17411739
17421740 return NewMusigPairSession (& MusigSessionCfg {
1743- LocalKey : ourContribution .MultiSigKey ,
1744- RemoteKey : theirContribution .MultiSigKey ,
1745- LocalNonce : * ourContribution .LocalNonce ,
1746- RemoteNonce : * theirContribution .LocalNonce ,
1747- Signer : signer ,
1748- InputTxOut : fundingOutput ,
1741+ LocalKey : ourContribution .MultiSigKey ,
1742+ RemoteKey : theirContribution .MultiSigKey ,
1743+ LocalNonce : * ourContribution .LocalNonce ,
1744+ RemoteNonce : * theirContribution .LocalNonce ,
1745+ Signer : signer ,
1746+ InputTxOut : fundingOutput ,
1747+ TapscriptTweak : tapscriptRoot ,
17491748 })
17501749}
17511750
@@ -1795,6 +1794,7 @@ func (l *LightningWallet) signCommitTx(pendingReservation *ChannelReservation,
17951794 musigSessions := genMusigSession (
17961795 ourContribution , theirContribution ,
17971796 l .Cfg .Signer , fundingOutput ,
1797+ pendingReservation .partialState .TapscriptRoot ,
17981798 )
17991799 pendingReservation .musigSessions = musigSessions
18001800 }
@@ -2189,6 +2189,7 @@ func (l *LightningWallet) verifyCommitSig(res *ChannelReservation,
21892189 res .musigSessions = genMusigSession (
21902190 res .ourContribution , res .theirContribution ,
21912191 l .Cfg .Signer , fundingOutput ,
2192+ res .partialState .TapscriptRoot ,
21922193 )
21932194 }
21942195
@@ -2279,9 +2280,6 @@ func (l *LightningWallet) handleFundingCounterPartySigs(msg *addCounterPartySigs
22792280
22802281 // As we're about to broadcast the funding transaction, we'll take note
22812282 // of the current height for record keeping purposes.
2282- //
2283- // TODO(roasbeef): this info can also be piped into light client's
2284- // basic fee estimation?
22852283 _ , bestHeight , err := l .Cfg .ChainIO .GetBestBlock ()
22862284 if err != nil {
22872285 msg .err <- err
0 commit comments