diff --git a/lnwire/message.go b/lnwire/message.go index eca3159b3..7f55fedda 100644 --- a/lnwire/message.go +++ b/lnwire/message.go @@ -69,6 +69,7 @@ type Message interface { Command() uint32 MaxPayloadLength(uint32) uint32 Validate() error + String() string } // makeEmptyMessage creates a new empty message of the proper concrete type diff --git a/lnwire/ping.go b/lnwire/ping.go index a8b03a6e9..24061379e 100644 --- a/lnwire/ping.go +++ b/lnwire/ping.go @@ -1,6 +1,9 @@ package lnwire -import "io" +import ( + "fmt" + "io" +) // Pong defines a message which is the direct response to a received Ping // message. A Pong reply indicates that a connection is still active. The Pong @@ -75,3 +78,10 @@ func (p *Pong) MaxPayloadLength(uint32) uint32 { func (p *Pong) Validate() error { return nil } + +// String returns the string representation of the target Pong. +// +// This is part of the lnwire.Message interface. +func (p *Pong) String() string { + return fmt.Sprintf("Pong(%v)", p.Nonce) +} diff --git a/lnwire/pong.go b/lnwire/pong.go index acfb89e95..1aeee3580 100644 --- a/lnwire/pong.go +++ b/lnwire/pong.go @@ -1,6 +1,9 @@ package lnwire -import "io" +import ( + "fmt" + "io" +) // Ping defines a message which is sent by peers periodically to determine if // the connection is still valid. Each ping message should carry a unique nonce @@ -74,3 +77,10 @@ func (p Ping) MaxPayloadLength(uint32) uint32 { func (p *Ping) Validate() error { return nil } + +// String returns the string representation of the target Ping. +// +// This is part of the lnwire.Message interface. +func (p *Ping) String() string { + return fmt.Sprintf("Ping(%v)", p.Nonce) +}