From eea48f8bd51eead07ce903852af0449a7c8eb50c Mon Sep 17 00:00:00 2001 From: Giovanni Petrantoni Date: Tue, 23 Jun 2020 17:05:13 +0900 Subject: [PATCH] fix encodePrune --- libp2p/protocols/pubsub/rpc/protobuf.nim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libp2p/protocols/pubsub/rpc/protobuf.nim b/libp2p/protocols/pubsub/rpc/protobuf.nim index 9efa02fee..8d500667b 100644 --- a/libp2p/protocols/pubsub/rpc/protobuf.nim +++ b/libp2p/protocols/pubsub/rpc/protobuf.nim @@ -32,8 +32,13 @@ proc encodePeerInfo*(info: PeerInfoMsg, pb: var ProtoBuffer) {.gcsafe.} = proc encodePrune*(prune: ControlPrune, pb: var ProtoBuffer) {.gcsafe.} = pb.write(initProtoField(1, prune.topicID)) + + var peers = initProtoBuffer() for p in prune.peers: - encodePeerInfo(p, pb) + p.encodePeerInfo(peers) + peers.finish() + pb.write(initProtoField(2, peers)) + pb.write(initProtoField(3, prune.backoff)) proc decodePrune*(pb: var ProtoBuffer): seq[ControlPrune] {.gcsafe.} =