From 88a8c6618de93b5a71aa27846decbe9d7fea406b Mon Sep 17 00:00:00 2001 From: ziggie Date: Sun, 8 Jan 2023 00:07:35 +0100 Subject: [PATCH] lnwire: add custom message to fuzz tests --- lnwire/fuzz_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lnwire/fuzz_test.go b/lnwire/fuzz_test.go index 4ec35e6dd..34d144c84 100644 --- a/lnwire/fuzz_test.go +++ b/lnwire/fuzz_test.go @@ -807,3 +807,18 @@ func FuzzUpdateFulfillHTLC(f *testing.F) { harness(t, data) }) } + +func FuzzCustomMessage(f *testing.F) { + f.Fuzz(func(t *testing.T, data []byte, customMessageType uint16) { + if customMessageType < uint16(CustomTypeStart) { + customMessageType += uint16(CustomTypeStart) + } + + // Prefix with CustomMessage. + data = prefixWithMsgType(data, MessageType(customMessageType)) + + // Pass the message into our general fuzz harness for wire + // messages! + harness(t, data) + }) +}