lnwire: add warning message wrapping existing Error message structure

This commit adds Warning messages to lnwire, as introduced in bolts/950.
It does not include reading/writing of warning messages, which will be
covered in followup commits.
This commit is contained in:
Carla Kirk-Cohen committed 2022-05-16 13:51:29 -04:00
1 parent 04fb034259
commit f5ef4992e0
3 files changed
+34 -1

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
package lnwire
// A compile time check to ensure Warning implements the lnwire.Message
// interface.
var _ Message = (*Warning)(nil)
// Warning is used to express non-critical errors in the protocol, providing
// a "soft" way for nodes to communicate failures. Since it has the same
// structure as errors, warnings simply include an Error so that we can leverage
// their encode/decode functionality, and over write the MsgType function to
// differentiate them.
type Warning struct {
Error
}
// MsgType returns the integer uniquely identifying an Warning message on the
// wire.
//
// This is part of the lnwire.Message interface.
func (c *Warning) MsgType() MessageType {
return MsgWarning
}