lnwire: re-add .String() to the lnwire.Message interface

This commit is contained in:
Olaoluwa Osuntokun 2016-11-10 17:47:59 -08:00
parent a4023144d3
commit 7fc6159f0a
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
3 changed files with 23 additions and 2 deletions

@ -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

@ -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)
}

@ -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)
}