Update nwaku RPC with nanoseconds timestamp

This commit is contained in:
Franck Royer 2022-02-24 12:21:24 +11:00 committed by Franck
parent 09e227f5a7
commit c8300d4dfc
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 2 additions and 7 deletions

View File

@ -64,7 +64,7 @@ export interface KeyPair {
export interface WakuRelayMessage {
payload: string;
contentTopic?: string;
timestamp?: number; // Float in seconds
timestamp?: number; // Integer in seconds
}
export class NimWaku {
@ -194,12 +194,7 @@ export class NimWaku {
}
let timestamp;
if (message.timestamp) {
timestamp = message.timestamp.valueOf() / 1000;
if (Number.isInteger(timestamp)) {
// Add a millisecond to ensure it's not an integer
// Until https://github.com/status-im/nim-waku/issues/691 is done
timestamp += 0.001;
}
timestamp = message.timestamp.valueOf() * 1000;
}
const rpcMessage = {