lnwallet: add support for taproot chans to createHtlcRetribution
As these are revoked HTLCs, we need to set the taptweak since the revocation case is just a keyspend.
This commit is contained in:
1 file changed
+15
-3
+15
-3
@@ -2583,8 +2583,7 @@ func createHtlcRetribution(chanState *channeldb.OpenChannel,
|
|||||||
return emptyRetribution, err
|
return emptyRetribution, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return HtlcRetribution{
|
signDesc := input.SignDescriptor{
|
||||||
SignDesc: input.SignDescriptor{
|
|
||||||
KeyDesc: chanState.LocalChanCfg.
|
KeyDesc: chanState.LocalChanCfg.
|
||||||
RevocationBasePoint,
|
RevocationBasePoint,
|
||||||
DoubleTweak: commitmentSecret,
|
DoubleTweak: commitmentSecret,
|
||||||
@@ -2594,7 +2593,20 @@ func createHtlcRetribution(chanState *channeldb.OpenChannel,
|
|||||||
Value: int64(htlc.Amt),
|
Value: int64(htlc.Amt),
|
||||||
},
|
},
|
||||||
HashType: txscript.SigHashAll,
|
HashType: txscript.SigHashAll,
|
||||||
},
|
}
|
||||||
|
|
||||||
|
// For taproot HTLC outputs, we need to set the sign method to key
|
||||||
|
// spend, and also set the tap tweak root needed to derive the proper
|
||||||
|
// private key.
|
||||||
|
if chanState.ChanType.IsTaproot() {
|
||||||
|
signDesc.SignMethod = input.TaprootKeySpendSignMethod
|
||||||
|
|
||||||
|
tapscriptRoot := scriptInfo.ScriptTree.RootNode.TapHash()
|
||||||
|
signDesc.TapTweak = tapscriptRoot[:]
|
||||||
|
}
|
||||||
|
|
||||||
|
return HtlcRetribution{
|
||||||
|
SignDesc: signDesc,
|
||||||
OutPoint: wire.OutPoint{
|
OutPoint: wire.OutPoint{
|
||||||
Hash: commitHash,
|
Hash: commitHash,
|
||||||
Index: uint32(htlc.OutputIndex),
|
Index: uint32(htlc.OutputIndex),
|
||||||
|
|||||||
Reference in new issue
Block a user