Skip to content

Commit a232b58

Browse files
committed
fixup! lnwallet: funding revamp checkpoint
1 parent de780e8 commit a232b58

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

lnwallet/wallet.go

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,21 +1480,28 @@ func (l *LightningWallet) handleFundingCancelRequest(req *fundingReserveCancelMs
14801480
// createCommitOpts is a struct that holds the options for creating a a new
14811481
// commitment transaction.
14821482
type createCommitOpts struct {
1483-
auxLeaves fn.Option[CommitAuxLeaves]
1483+
localAuxLeaves fn.Option[CommitAuxLeaves]
1484+
remoteAuxLeaves fn.Option[CommitAuxLeaves]
14841485
}
14851486

14861487
// defaultCommitOpts returns a new createCommitOpts with default values.
14871488
func defaultCommitOpts() createCommitOpts {
14881489
return createCommitOpts{}
14891490
}
14901491

1491-
// WithAuxLeaves is a functional option that can be used to set the aux leaves
1492-
// for a new commitment transaction.
1493-
//
1494-
// TODO(roasbeef): local+remote leaves
1495-
func WithAuxLeaves(leaves fn.Option[CommitAuxLeaves]) CreateCommitOpt {
1492+
// WithLocalAuxLeaves is a functional option that can be used to set the local
1493+
// aux leaves for a new commitment transaction.
1494+
func WithLocalAuxLeaves(leaves fn.Option[CommitAuxLeaves]) CreateCommitOpt {
1495+
return func(o *createCommitOpts) {
1496+
o.localAuxLeaves = leaves
1497+
}
1498+
}
1499+
1500+
// WithRemoteAuxLeaves is a functional option that can be used to set the remote
1501+
// aux leaves for a new commitment transaction.
1502+
func WithRemoteAuxLeaves(leaves fn.Option[CommitAuxLeaves]) CreateCommitOpt {
14961503
return func(o *createCommitOpts) {
1497-
o.auxLeaves = leaves
1504+
o.remoteAuxLeaves = leaves
14981505
}
14991506
}
15001507

@@ -1528,7 +1535,7 @@ func CreateCommitmentTxns(localBalance, remoteBalance btcutil.Amount,
15281535
ourCommitTx, err := CreateCommitTx(
15291536
chanType, fundingTxIn, localCommitmentKeys, ourChanCfg,
15301537
theirChanCfg, localBalance, remoteBalance, 0, initiator,
1531-
leaseExpiry, options.auxLeaves,
1538+
leaseExpiry, options.localAuxLeaves,
15321539
)
15331540
if err != nil {
15341541
return nil, nil, err
@@ -1542,7 +1549,7 @@ func CreateCommitmentTxns(localBalance, remoteBalance btcutil.Amount,
15421549
theirCommitTx, err := CreateCommitTx(
15431550
chanType, fundingTxIn, remoteCommitmentKeys, theirChanCfg,
15441551
ourChanCfg, remoteBalance, localBalance, 0, !initiator,
1545-
leaseExpiry, options.auxLeaves,
1552+
leaseExpiry, options.remoteAuxLeaves,
15461553
)
15471554
if err != nil {
15481555
return nil, nil, err
@@ -1903,7 +1910,8 @@ func (l *LightningWallet) handleChanPointReady(req *continueContributionMsg) {
19031910
theirContribution.FirstCommitmentPoint, fundingTxIn,
19041911
pendingReservation.partialState.ChanType,
19051912
pendingReservation.partialState.IsInitiator, leaseExpiry,
1906-
WithAuxLeaves(pendingReservation.initAuxLeaves),
1913+
WithLocalAuxLeaves(pendingReservation.localInitAuxLeaves),
1914+
WithRemoteAuxLeaves(pendingReservation.remoteInitAuxLeaves),
19071915
)
19081916
if err != nil {
19091917
req.err <- err
@@ -2345,7 +2353,8 @@ func (l *LightningWallet) handleSingleFunderSigs(req *addSingleFunderSigsMsg) {
23452353
pendingReservation.theirContribution.FirstCommitmentPoint,
23462354
*fundingTxIn, chanType,
23472355
pendingReservation.partialState.IsInitiator, leaseExpiry,
2348-
WithAuxLeaves(pendingReservation.initAuxLeaves),
2356+
WithLocalAuxLeaves(pendingReservation.localInitAuxLeaves),
2357+
WithRemoteAuxLeaves(pendingReservation.remoteInitAuxLeaves),
23492358
)
23502359
if err != nil {
23512360
req.err <- err

0 commit comments

Comments
 (0)