Skip to content

Commit aa48343

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 0896624 commit aa48343

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

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

0 commit comments

Comments
 (0)