Updates the field number of proof and timestamp (#457)

* updates the fields numbers of proof and timestamp

* clarifies that proof is not part of waku message specs

* Update waku/v2/protocol/waku_message.nim

Co-authored-by: Oskar Thorén <ot@oskarthoren.com>

* fixes indentation

Co-authored-by: Oskar Thorén <ot@oskarthoren.com>
This commit is contained in:
Sanaz Taheri Boshrooyeh 2021-04-07 11:08:46 -07:00 committed by GitHub
parent a0dba2fea4
commit d49cb53b56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 7 deletions

View File

@ -16,11 +16,13 @@ type
payload*: seq[byte]
contentTopic*: ContentTopic
version*: uint32
# the proof field indicates that the message is not a spam
# this field will be used in the rln-relay protocol
proof*: seq[byte]
# sender generated timestamp
timestamp*: float64
# the proof field indicates that the message is not a spam
# this field will be used in the rln-relay protocol
# XXX Experimental, this is part of https://rfc.vac.dev/spec/17/ spec and not yet part of WakuMessage spec
proof*: seq[byte]
# Encoding and decoding -------------------------------------------------------
proc init*(T: type WakuMessage, buffer: seq[byte]): ProtoResult[T] =
@ -30,8 +32,9 @@ proc init*(T: type WakuMessage, buffer: seq[byte]): ProtoResult[T] =
discard ? pb.getField(1, msg.payload)
discard ? pb.getField(2, msg.contentTopic)
discard ? pb.getField(3, msg.version)
discard ? pb.getField(4, msg.proof)
discard ? pb.getField(5, msg.timestamp)
discard ? pb.getField(4, msg.timestamp)
# XXX Experimental, this is part of https://rfc.vac.dev/spec/17/ spec and not yet part of WakuMessage spec
discard ? pb.getField(21, msg.proof)
ok(msg)
@ -41,5 +44,5 @@ proc encode*(message: WakuMessage): ProtoBuffer =
result.write(1, message.payload)
result.write(2, message.contentTopic)
result.write(3, message.version)
result.write(4, message.proof)
result.write(5, message.timestamp)
result.write(4, message.timestamp)
result.write(21, message.proof)