avoid sending empty seqno and/or fromPeer (gossip rpc) (#364)
This commit is contained in:
parent
e2d46c6b53
commit
a6007be428
|
@ -68,8 +68,10 @@ proc write*(pb: var ProtoBuffer, field: int, subs: SubOpts) =
|
||||||
|
|
||||||
proc encodeMessage*(msg: Message): seq[byte] =
|
proc encodeMessage*(msg: Message): seq[byte] =
|
||||||
var pb = initProtoBuffer()
|
var pb = initProtoBuffer()
|
||||||
|
if len(msg.fromPeer) > 0:
|
||||||
pb.write(1, msg.fromPeer)
|
pb.write(1, msg.fromPeer)
|
||||||
pb.write(2, msg.data)
|
pb.write(2, msg.data)
|
||||||
|
if len(msg.seqno) > 0:
|
||||||
pb.write(3, msg.seqno)
|
pb.write(3, msg.seqno)
|
||||||
for topic in msg.topicIDs:
|
for topic in msg.topicIDs:
|
||||||
pb.write(4, topic)
|
pb.write(4, topic)
|
||||||
|
|
Loading…
Reference in New Issue