lnwire: add IsChannelUpdate function to distinguish channel updates
This commit is contained in:
1 file changed
+19
@@ -63,6 +63,25 @@ const (
|
|||||||
MsgKickoffSig = 777
|
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.
|
// ErrorEncodeMessage is used when failed to encode the message payload.
|
||||||
func ErrorEncodeMessage(err error) error {
|
func ErrorEncodeMessage(err error) error {
|
||||||
return fmt.Errorf("failed to encode message to buffer, got %w", err)
|
return fmt.Errorf("failed to encode message to buffer, got %w", err)
|
||||||
|
|||||||
Reference in new issue
Block a user