Skip to content

Commit 15df164

Browse files
committed
tapchannel: use ScriptPathTimeout path for local HTLC timeout
1 parent 82758bc commit 15df164

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

tapchannel/aux_sweeper.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,6 @@ func localHtlcTimeoutSweepDesc(req lnwallet.ResolutionReq,
784784
) lfn.Result[tapscriptSweepDescs] {
785785

786786
isIncoming := false
787-
localCommit := true
788787

789788
payHash, err := req.PayHash.UnwrapOrErr(
790789
fmt.Errorf("no pay hash"),
@@ -802,7 +801,7 @@ func localHtlcTimeoutSweepDesc(req lnwallet.ResolutionReq,
802801
// We'll need to complete the control block to spend the second-level
803802
// HTLC, so first we'll make the script tree for the HTLC.
804803
htlcScriptTree, err := lnwallet.GenTaprootHtlcScript(
805-
isIncoming, localCommit, htlcExpiry,
804+
isIncoming, lntypes.Local, htlcExpiry,
806805
payHash, req.KeyRing, lfn.None[txscript.TapLeaf](),
807806
)
808807
if err != nil {
@@ -811,9 +810,8 @@ func localHtlcTimeoutSweepDesc(req lnwallet.ResolutionReq,
811810
}
812811

813812
// Now that we have the script tree, we'll make the control block needed
814-
// to spend it, but taking the revoked path.
815813
ctrlBlock, err := htlcScriptTree.CtrlBlockForPath(
816-
input.ScriptPathSuccess,
814+
input.ScriptPathTimeout,
817815
)
818816
if err != nil {
819817
return lfn.Err[tapscriptSweepDescs](err)
@@ -878,7 +876,6 @@ func localHtlcSucessSweepDesc(req lnwallet.ResolutionReq,
878876
) lfn.Result[tapscriptSweepDescs] {
879877

880878
isIncoming := true
881-
localCommit := true
882879

883880
payHash, err := req.PayHash.UnwrapOrErr(
884881
fmt.Errorf("no pay hash"),
@@ -896,7 +893,7 @@ func localHtlcSucessSweepDesc(req lnwallet.ResolutionReq,
896893
// We'll need to complete the control block to spend the second-level
897894
// HTLC, so first we'll make the script tree for the HTLC.
898895
htlcScriptTree, err := lnwallet.GenTaprootHtlcScript(
899-
isIncoming, localCommit, htlcExpiry,
896+
isIncoming, lntypes.Local, htlcExpiry,
900897
payHash, req.KeyRing, lfn.None[txscript.TapLeaf](),
901898
)
902899
if err != nil {
@@ -905,7 +902,7 @@ func localHtlcSucessSweepDesc(req lnwallet.ResolutionReq,
905902
}
906903

907904
// Now that we have the script tree, we'll make the control block needed
908-
// to spend it, but taking the revoked path.
905+
// to spend it, but taking the success path.
909906
ctrlBlock, err := htlcScriptTree.CtrlBlockForPath(
910907
input.ScriptPathSuccess,
911908
)

0 commit comments

Comments
 (0)