Add WakuMessage version as per spec (#250)

This commit is contained in:
Dean Eigenmann 2020-10-30 16:46:07 +01:00 committed by GitHub
parent 0cb2e125b6
commit 6262f01c7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -24,6 +24,7 @@ type
WakuMessage* = object
payload*: seq[byte]
contentTopic*: ContentTopic
version*: string
MessageNotificationHandler* = proc(topic: string, msg: WakuMessage): Future[
void] {.gcsafe, closure.}
@ -151,6 +152,7 @@ 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)
ok(msg)
@ -159,6 +161,7 @@ proc encode*(message: WakuMessage): ProtoBuffer =
result.write(1, message.payload)
result.write(2, message.contentTopic)
result.write(3, message.version)
proc notify*(filters: Filters, msg: WakuMessage, requestId: string = "") =
for key in filters.keys:

View File

@ -16,7 +16,6 @@ logScope:
const
WakuStoreCodec* = "/vac/waku/store/2.0.0-beta1"
proc encode*(index: Index): ProtoBuffer =
## encodes an Index object into a ProtoBuffer
## returns the resultant ProtoBuffer