lnwire: add custom records field to type UpdateFulfillHtlc

- Introduce the field `CustomRecords` to the type `UpdateFulfillHtlc`.
- Encode and decode the new field into the `ExtraData` field of the
`update_fulfill_htlc` wire message.
- Empty `ExtraData` field is set to `nil`.
This commit is contained in:
ffranr
2024-05-03 16:22:05 +01:00
committed by Oliver Gugger
parent 81f6a8060f
commit 8d1059f41c
5 changed files with 188 additions and 6 deletions

View File

@@ -1442,6 +1442,29 @@ func TestLightningWireProtocol(t *testing.T) {
)
}
v[0] = reflect.ValueOf(*req)
},
MsgUpdateFulfillHTLC: func(v []reflect.Value, r *rand.Rand) {
req := &UpdateFulfillHTLC{
ID: r.Uint64(),
}
_, err := r.Read(req.ChanID[:])
require.NoError(t, err)
_, err = r.Read(req.PaymentPreimage[:])
require.NoError(t, err)
req.CustomRecords = randCustomRecords(t, r)
// Generate some random TLV records 50% of the time.
if r.Int31()%2 == 0 {
req.ExtraData = []byte{
0x01, 0x03, 1, 2, 3,
0x02, 0x03, 4, 5, 6,
}
}
v[0] = reflect.ValueOf(*req)
},
}