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

This commit is contained in:
Olaoluwa Osuntokun committed 2016-11-10 17:48:09 -08:00
1 parent a4023144d3
commit 7fc6159f0a
3 files changed
+23 -2

No files matched your search

+1
View File
@@ -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
+11 -1
View File
@@ -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)
}
+11 -1
View File
@@ -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)
}