Fixed bug:m network.proto backwards compatibility unmarshal

This commit is contained in:
Milos Gajdos 2020-01-15 19:45:43 +00:00
parent 7c7b0ced5f
commit 36928b716c
No known key found for this signature in database
GPG Key ID: 8B31058CC55DFD4F

View File

@ -70,12 +70,22 @@ func newStatus() *status {
}
func newPeerStatus(peer *pb.Peer) *status {
return &status{
err: &nerr{
count: int(peer.Node.Status.Error.Count),
msg: errors.New(peer.Node.Status.Error.Msg),
},
status := &status{
err: new(nerr),
}
// if Node.Status is nil, return empty status
if peer.Node.Status == nil {
return status
}
// if peer.Node.Status.Error is NOT nil, update status fields
if err := peer.Node.Status.GetError(); err != nil {
status.err.count = int(peer.Node.Status.Error.Count)
status.err.msg = errors.New(peer.Node.Status.Error.Msg)
}
return status
}
func (s *status) Error() Error {