Skip to content

Commit 6826f2e

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 768c343 commit 6826f2e

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
@@ -447,9 +447,19 @@ func (a *AuxSweeper) createAndSignSweepVpackets(
447447
signPkts := func(vPkts []*tappsbt.VPacket,
448448
desc tapscriptSweepDesc) lfn.Result[[]*tappsbt.VPacket] {
449449

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

0 commit comments

Comments
 (0)