refactor: ToMessage isnt needed
This commit is contained in:
parent
2a0a817006
commit
e011d452d5
|
@ -9,17 +9,12 @@ var (
|
|||
//go:generate mockgen -source=encodeable_message.go -destination=../mocks/base/encodeable_message.go -package=base
|
||||
|
||||
type EncodeableMessage interface {
|
||||
ToMessage() (message []byte, err error)
|
||||
msgpack.CustomEncoder
|
||||
}
|
||||
|
||||
type EncodeableMessageImpl struct {
|
||||
}
|
||||
|
||||
func (e EncodeableMessageImpl) ToMessage() (message []byte, err error) {
|
||||
return msgpack.Marshal(e)
|
||||
}
|
||||
|
||||
func (e EncodeableMessageImpl) EncodeMsgpack(encoder *msgpack.Encoder) error {
|
||||
panic("this method should be implemented by the child class")
|
||||
}
|
||||
|
|
|
@ -219,8 +219,7 @@ func (p *P2PImpl) OnNewPeer(peer net.Peer, verifyId bool) error {
|
|||
p.OnNewPeerListen(peer, verifyId)
|
||||
}()
|
||||
|
||||
handshakeOpenMsg, err := protocol.NewHandshakeOpen(challenge, p.networkID).ToMessage()
|
||||
|
||||
handshakeOpenMsg, err := msgpack.Marshal(protocol.NewHandshakeOpen(challenge, p.networkID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue