fix encodePrune

This commit is contained in:
Giovanni Petrantoni 2020-06-23 17:05:13 +09:00
parent 7748b8c5c9
commit eea48f8bd5
1 changed files with 6 additions and 1 deletions

View File

@ -32,8 +32,13 @@ proc encodePeerInfo*(info: PeerInfoMsg, pb: var ProtoBuffer) {.gcsafe.} =
proc encodePrune*(prune: ControlPrune, pb: var ProtoBuffer) {.gcsafe.} = proc encodePrune*(prune: ControlPrune, pb: var ProtoBuffer) {.gcsafe.} =
pb.write(initProtoField(1, prune.topicID)) pb.write(initProtoField(1, prune.topicID))
var peers = initProtoBuffer()
for p in prune.peers: for p in prune.peers:
encodePeerInfo(p, pb) p.encodePeerInfo(peers)
peers.finish()
pb.write(initProtoField(2, peers))
pb.write(initProtoField(3, prune.backoff)) pb.write(initProtoField(3, prune.backoff))
proc decodePrune*(pb: var ProtoBuffer): seq[ControlPrune] {.gcsafe.} = proc decodePrune*(pb: var ProtoBuffer): seq[ControlPrune] {.gcsafe.} =