channeldb: convert HTLCEntry to use tlv.RecordT
This commit is contained in:
1 parent
c1e641e9d9
commit
1b1e7a6168
5 files changed
+212
-166
No files matched your search
+18
-11
@@ -9957,9 +9957,11 @@ func TestCreateHtlcRetribution(t *testing.T) {
|
||||
aliceChannel.channelState,
|
||||
)
|
||||
htlc := &channeldb.HTLCEntry{
|
||||
Amt: testAmt,
|
||||
Incoming: true,
|
||||
OutputIndex: 1,
|
||||
Amt: tlv.NewRecordT[tlv.TlvType4](
|
||||
tlv.NewBigSizeT(testAmt),
|
||||
),
|
||||
Incoming: tlv.NewPrimitiveRecord[tlv.TlvType3](true),
|
||||
OutputIndex: tlv.NewPrimitiveRecord[tlv.TlvType2, uint16](1),
|
||||
}
|
||||
|
||||
// Create the htlc retribution.
|
||||
@@ -9973,8 +9975,8 @@ func TestCreateHtlcRetribution(t *testing.T) {
|
||||
// Check the fields have expected values.
|
||||
require.EqualValues(t, testAmt, hr.SignDesc.Output.Value)
|
||||
require.Equal(t, commitHash, hr.OutPoint.Hash)
|
||||
require.EqualValues(t, htlc.OutputIndex, hr.OutPoint.Index)
|
||||
require.Equal(t, htlc.Incoming, hr.IsIncoming)
|
||||
require.EqualValues(t, htlc.OutputIndex.Val, hr.OutPoint.Index)
|
||||
require.Equal(t, htlc.Incoming.Val, hr.IsIncoming)
|
||||
}
|
||||
|
||||
// TestCreateBreachRetribution checks that `createBreachRetribution` behaves as
|
||||
@@ -10014,9 +10016,13 @@ func TestCreateBreachRetribution(t *testing.T) {
|
||||
aliceChannel.channelState,
|
||||
)
|
||||
htlc := &channeldb.HTLCEntry{
|
||||
Amt: btcutil.Amount(testAmt),
|
||||
Incoming: true,
|
||||
OutputIndex: uint16(htlcIndex),
|
||||
Amt: tlv.NewRecordT[tlv.TlvType4](
|
||||
tlv.NewBigSizeT(btcutil.Amount(testAmt)),
|
||||
),
|
||||
Incoming: tlv.NewPrimitiveRecord[tlv.TlvType3](true),
|
||||
OutputIndex: tlv.NewPrimitiveRecord[tlv.TlvType2](
|
||||
uint16(htlcIndex),
|
||||
),
|
||||
}
|
||||
|
||||
// Create a dummy revocation log.
|
||||
@@ -10143,11 +10149,12 @@ func TestCreateBreachRetribution(t *testing.T) {
|
||||
require.Equal(t, remote, br.RemoteOutpoint)
|
||||
|
||||
for _, hr := range br.HtlcRetributions {
|
||||
require.EqualValues(t, testAmt,
|
||||
hr.SignDesc.Output.Value)
|
||||
require.EqualValues(
|
||||
t, testAmt, hr.SignDesc.Output.Value,
|
||||
)
|
||||
require.Equal(t, commitHash, hr.OutPoint.Hash)
|
||||
require.EqualValues(t, htlcIndex, hr.OutPoint.Index)
|
||||
require.Equal(t, htlc.Incoming, hr.IsIncoming)
|
||||
require.Equal(t, htlc.Incoming.Val, hr.IsIncoming)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user