From 075ac7484ca79c1531fb150e945ae0cbc317a8d9 Mon Sep 17 00:00:00 2001 From: Vibhav Pant Date: Wed, 25 Mar 2020 17:42:49 +0530 Subject: [PATCH] (*PeerRecord.MarshalRecord): Use ToProtobuf() to get protobuf struct --- peer/record.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/peer/record.go b/peer/record.go index f21b0da..60373c3 100644 --- a/peer/record.go +++ b/peer/record.go @@ -153,16 +153,11 @@ func (r *PeerRecord) UnmarshalRecord(bytes []byte) error { // This method is called automatically when constructing a routing.Envelope // using Seal or PeerRecord.Sign. func (r *PeerRecord) MarshalRecord() ([]byte, error) { - idBytes, err := r.PeerID.MarshalBinary() + msg, err := r.ToProtobuf() if err != nil { return nil, err } - msg := pb.PeerRecord{ - PeerId: idBytes, - Addresses: addrsToProtobuf(r.Addrs), - Seq: r.Seq, - } - return proto.Marshal(&msg) + return proto.Marshal(msg) } // Equal returns true if the other PeerRecord is identical to this one.