Skip to content

Commit 28c904a

Browse files
committed
tapchannel: update createAndSignSweepVpackets to be 2nd level aware
In this commit, we make sure to pass in the correct signDesc when we go to sign for a second level txn. For a 2nd level txn, we'll actually use the signDesc that's needed to generate the 2-of-2 multi-sig, instead of the one that we'd normally use to sweep.
1 parent 88de9c9 commit 28c904a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tapchannel/aux_sweeper.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,19 @@ func (a *AuxSweeper) createAndSignSweepVpackets(
446446
signPkts := func(vPkts []*tappsbt.VPacket,
447447
desc tapscriptSweepDesc) lfn.Result[[]*tappsbt.VPacket] {
448448

449+
// If this is a second level output, then we'll use the
450+
// specified aux sign desc, otherwise, we'll use the
451+
// normal one.
452+
signDesc := lfn.MapOption(
453+
func(aux lnwallet.AuxSigDesc) input.SignDescriptor {
454+
return aux.SignDetails.SignDesc
455+
},
456+
)(desc.auxSigInfo).UnwrapOr(resReq.SignDesc)
457+
449458
err := a.signSweepVpackets(
450-
vPkts, resReq.SignDesc, nil, nil,
451-
lfn.None[lnwallet.AuxSigDesc](), lfn.None[uint32](),
459+
vPkts, signDesc, desc.scriptTree.TapTweak(),
460+
desc.ctrlBlockBytes, desc.auxSigInfo,
461+
desc.secondLevelSigIndex,
452462
)
453463
if err != nil {
454464
return lfn.Err[returnType](err)

0 commit comments

Comments
 (0)