From 5739061f13d37777d0f774238f9ad67b5783d33d Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 13 Aug 2023 13:35:55 -0700 Subject: [PATCH] lnwallet: add first+second level taptweaks to htlc retribution The first and second level taptweaks need to be stored in order to ensure the breach arb can play revocations at both the first and second level. --- lnwallet/channel.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 92ccd1a02..417501038 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -2667,7 +2667,7 @@ func createHtlcRetribution(chanState *channeldb.OpenChannel, signDesc.TapTweak = scriptTree.TapTweak() } - // The second levle script we sign will always be the sucess path. + // The second level script we sign will always be the success path. secondLevelWitnessScript, err := secondLevelScript.WitnessScriptForPath( input.ScriptPathSuccess, ) @@ -2679,9 +2679,7 @@ func createHtlcRetribution(chanState *channeldb.OpenChannel, // level tap tweak as well. var secondLevelTapTweak [32]byte if scriptTree, ok := secondLevelScript.(input.TapscriptDescriptor); ok { - copy( - secondLevelTapTweak[:], scriptTree.TapTweak(), - ) + copy(secondLevelTapTweak[:], scriptTree.TapTweak()) } return HtlcRetribution{ @@ -2691,8 +2689,8 @@ func createHtlcRetribution(chanState *channeldb.OpenChannel, Index: uint32(htlc.OutputIndex), }, SecondLevelWitnessScript: secondLevelWitnessScript, - SecondLevelTapTweak: secondLevelTapTweak, IsIncoming: htlc.Incoming, + SecondLevelTapTweak: secondLevelTapTweak, }, nil }