lnwire: specify random fields for UpdateFulfillHTLC message in fuzz test

This commit defines random fields for the `UpdateFulfillHTLC` message
as part of the encode/decode unit tests.
This commit is contained in:
ffranr 2024-05-14 13:01:07 +01:00
parent 5c3f7bec0f
commit 406fbe243e
No known key found for this signature in database
GPG Key ID: B1F8848557AA29D2

View File

@ -1414,6 +1414,21 @@ 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)
v[0] = reflect.ValueOf(req)
},
}
// With the above types defined, we'll now generate a slice of