Skip to content

Commit 2195041

Browse files
committed
tapchannel: properly use htlc keys when making htlc tap descs
1 parent d3fe0e5 commit 2195041

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

tapchannel/aux_sweeper.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,7 @@ func commitNoDelaySweepDesc(keyRing *lnwallet.CommitmentKeyRing,
632632
input.ScriptPathSuccess,
633633
)
634634
if err != nil {
635+
return lfn.Err[returnType](err)
635636
}
636637
ctrlBlockBytes, err := ctrlBlock.ToBytes()
637638
if err != nil {
@@ -673,6 +674,7 @@ func commitDelaySweepDesc(keyRing *lnwallet.CommitmentKeyRing,
673674
input.ScriptPathSuccess,
674675
)
675676
if err != nil {
677+
return lfn.Err[returnType](err)
676678
}
677679
ctrlBlockBytes, err := ctrlBlock.ToBytes()
678680
if err != nil {
@@ -737,8 +739,9 @@ func remoteHtlcTimeoutSweepDesc(keyRing *lnwallet.CommitmentKeyRing,
737739
// We're sweeping a timed out HTLC, which means that we'll need to
738740
// create the receiver's HTLC script tree (from the remote party's PoV).
739741
htlcScriptTree, err := input.ReceiverHTLCScriptTaproot(
740-
htlcExpiry, keyRing.ToLocalKey, keyRing.ToRemoteKey,
741-
keyRing.RevocationKey, payHash, lntypes.Remote, input.NoneTapLeaf(),
742+
htlcExpiry, keyRing.LocalHtlcKey, keyRing.RemoteHtlcKey,
743+
keyRing.RevocationKey, payHash, lntypes.Remote,
744+
input.NoneTapLeaf(),
742745
)
743746
if err != nil {
744747
return lfn.Err[tapscriptSweepDescs](err)
@@ -771,15 +774,15 @@ func remoteHtlcTimeoutSweepDesc(keyRing *lnwallet.CommitmentKeyRing,
771774
// the remote party's commitment transaction that we can sweep with the
772775
// preimage.
773776
func remoteHtlcSuccessSweepDesc(keyRing *lnwallet.CommitmentKeyRing,
774-
payHash []byte, csvDelay uint32,
775-
auxSigs lfn.Option[lnwallet.AuxSigDesc]) lfn.Result[tapscriptSweepDescs] {
777+
payHash []byte, csvDelay uint32) lfn.Result[tapscriptSweepDescs] {
776778

777779
// We're planning on sweeping an HTLC that we know the preimage to,
778780
// which the remote party sent, so we'll construct the sender version of
779781
// the HTLC script tree (from their PoV, they're the sender).
780782
htlcScriptTree, err := input.SenderHTLCScriptTaproot(
781-
keyRing.ToLocalKey, keyRing.ToRemoteKey, keyRing.RevocationKey,
782-
payHash, lntypes.Local, input.NoneTapLeaf(),
783+
keyRing.RemoteHtlcKey, keyRing.LocalHtlcKey,
784+
keyRing.RevocationKey, payHash, lntypes.Remote,
785+
input.NoneTapLeaf(),
783786
)
784787
if err != nil {
785788
return lfn.Err[tapscriptSweepDescs](err)
@@ -1733,7 +1736,6 @@ func (a *AuxSweeper) resolveContract(
17331736
// sweep desc for the timeout txn.
17341737
sweepDesc = remoteHtlcSuccessSweepDesc(
17351738
req.KeyRing, payHash[:], req.CsvDelay,
1736-
req.AuxSigDesc,
17371739
)
17381740

17391741
// In this case, we broadcast a commitment transaction which held an

0 commit comments

Comments
 (0)