channeldb: convert HTLCEntry to use tlv.RecordT

This commit is contained in:
Olaoluwa Osuntokun authored and Oliver Gugger committed 2024-08-28 13:21:46 +02:00
1 parent c1e641e9d9
commit 1b1e7a6168
5 files changed
+212 -166

No files matched your search

+6 -12
View File
@@ -2202,8 +2202,8 @@ func createHtlcRetribution(chanState *channeldb.OpenChannel,
// then from the PoV of the remote commitment state, they're the
// receiver of this HTLC.
scriptInfo, err := genHtlcScript(
chanState.ChanType, htlc.Incoming, lntypes.Remote,
htlc.RefundTimeout, htlc.RHash, keyRing,
chanState.ChanType, htlc.Incoming.Val, lntypes.Remote,
htlc.RefundTimeout.Val, htlc.RHash.Val, keyRing,
)
if err != nil {
return emptyRetribution, err
@@ -2216,7 +2216,7 @@ func createHtlcRetribution(chanState *channeldb.OpenChannel,
WitnessScript: scriptInfo.WitnessScriptToSign(),
Output: &wire.TxOut{
PkScript: scriptInfo.PkScript(),
Value: int64(htlc.Amt),
Value: int64(htlc.Amt.Val.Int()),
},
HashType: sweepSigHash(chanState.ChanType),
}
@@ -2249,10 +2249,10 @@ func createHtlcRetribution(chanState *channeldb.OpenChannel,
SignDesc: signDesc,
OutPoint: wire.OutPoint{
Hash: commitHash,
Index: uint32(htlc.OutputIndex),
Index: uint32(htlc.OutputIndex.Val),
},
SecondLevelWitnessScript: secondLevelWitnessScript,
IsIncoming: htlc.Incoming,
IsIncoming: htlc.Incoming.Val,
SecondLevelTapTweak: secondLevelTapTweak,
}, nil
}
@@ -2414,13 +2414,7 @@ func createBreachRetributionLegacy(revokedLog *channeldb.ChannelCommitment,
continue
}
entry := &channeldb.HTLCEntry{
RHash: htlc.RHash,
RefundTimeout: htlc.RefundTimeout,
OutputIndex: uint16(htlc.OutputIndex),
Incoming: htlc.Incoming,
Amt: htlc.Amt.ToSatoshis(),
}
entry := channeldb.NewHTLCEntryFromHTLC(htlc)
hr, err := createHtlcRetribution(
chanState, keyRing, commitHash,
commitmentSecret, leaseExpiry, entry,