mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2024-12-28 23:50:07 +08:00
(*PeerRecord.MarshalRecord): Use ToProtobuf() to get protobuf struct
This commit is contained in:
parent
4013be10ed
commit
075ac7484c
@ -153,16 +153,11 @@ func (r *PeerRecord) UnmarshalRecord(bytes []byte) error {
|
|||||||
// This method is called automatically when constructing a routing.Envelope
|
// This method is called automatically when constructing a routing.Envelope
|
||||||
// using Seal or PeerRecord.Sign.
|
// using Seal or PeerRecord.Sign.
|
||||||
func (r *PeerRecord) MarshalRecord() ([]byte, error) {
|
func (r *PeerRecord) MarshalRecord() ([]byte, error) {
|
||||||
idBytes, err := r.PeerID.MarshalBinary()
|
msg, err := r.ToProtobuf()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
msg := pb.PeerRecord{
|
return proto.Marshal(msg)
|
||||||
PeerId: idBytes,
|
|
||||||
Addresses: addrsToProtobuf(r.Addrs),
|
|
||||||
Seq: r.Seq,
|
|
||||||
}
|
|
||||||
return proto.Marshal(&msg)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Equal returns true if the other PeerRecord is identical to this one.
|
// Equal returns true if the other PeerRecord is identical to this one.
|
||||||
|
Loading…
Reference in New Issue
Block a user