From c9debea4082604083e781eb5465e0c6e14cc3e90 Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Fri, 9 Aug 2024 15:57:06 -0700 Subject: [PATCH] lnwire: add IsChannelUpdate function to distinguish channel updates --- lnwire/message.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lnwire/message.go b/lnwire/message.go index a758db000..68b09692e 100644 --- a/lnwire/message.go +++ b/lnwire/message.go @@ -63,6 +63,25 @@ const ( MsgKickoffSig = 777 ) +// IsChannelUpdate is a filter function that discerns channel update messages +// from the other messages in the Lightning Network Protocol. +func (t MessageType) IsChannelUpdate() bool { + switch t { + case MsgUpdateAddHTLC: + return true + case MsgUpdateFulfillHTLC: + return true + case MsgUpdateFailHTLC: + return true + case MsgUpdateFailMalformedHTLC: + return true + case MsgUpdateFee: + return true + default: + return false + } +} + // ErrorEncodeMessage is used when failed to encode the message payload. func ErrorEncodeMessage(err error) error { return fmt.Errorf("failed to encode message to buffer, got %w", err)