From 258cf6466d936ab99bdb0449f64b96fbf669106d Mon Sep 17 00:00:00 2001 From: Matt Morehouse Date: Fri, 11 Nov 2022 11:42:55 -0600 Subject: [PATCH] lnwire: add benchmark for Warning --- lnwire/message_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lnwire/message_test.go b/lnwire/message_test.go index b934b928d..f2b0892d7 100644 --- a/lnwire/message_test.go +++ b/lnwire/message_test.go @@ -259,6 +259,7 @@ func BenchmarkReadMessage(b *testing.B) { func makeAllMessages(t testing.TB, r *rand.Rand) []lnwire.Message { msgAll := []lnwire.Message{} + msgAll = append(msgAll, newMsgWarning(t, r)) msgAll = append(msgAll, newMsgInit(t, r)) msgAll = append(msgAll, newMsgError(t, r)) msgAll = append(msgAll, newMsgPing(t, r)) @@ -293,6 +294,19 @@ func makeAllMessages(t testing.TB, r *rand.Rand) []lnwire.Message { return msgAll } +func newMsgWarning(tb testing.TB, r io.Reader) *lnwire.Warning { + tb.Helper() + + msg := lnwire.NewWarning() + + _, err := r.Read(msg.ChanID[:]) + require.NoError(tb, err, "unable to generate chan id") + + msg.Data = createExtraData(tb, r) + + return msg +} + func newMsgInit(t testing.TB, r io.Reader) *lnwire.Init { t.Helper()