From 406fbe243e272377760ed70cc628050d531fd794 Mon Sep 17 00:00:00 2001 From: ffranr Date: Tue, 14 May 2024 13:01:07 +0100 Subject: [PATCH] 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. --- lnwire/lnwire_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lnwire/lnwire_test.go b/lnwire/lnwire_test.go index b07310398..c9413d4c2 100644 --- a/lnwire/lnwire_test.go +++ b/lnwire/lnwire_test.go @@ -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