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.
This commit is contained in:
Olaoluwa Osuntokun 2023-08-13 13:35:55 -07:00
parent 28c086f1fc
commit 5739061f13
No known key found for this signature in database
GPG Key ID: 3BBD59E99B280306

View File

@ -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
}