mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-07 16:23:09 +00:00
fixup!: don't read version
This commit is contained in:
parent
6beb32dd83
commit
7fdce8044a
@ -11,12 +11,10 @@ import type {
|
|||||||
PubsubTopic
|
PubsubTopic
|
||||||
} from "@waku/interfaces";
|
} from "@waku/interfaces";
|
||||||
import { proto_message as proto } from "@waku/proto";
|
import { proto_message as proto } from "@waku/proto";
|
||||||
import { Logger } from "@waku/utils";
|
|
||||||
import { bytesToHex } from "@waku/utils/bytes";
|
import { bytesToHex } from "@waku/utils/bytes";
|
||||||
|
|
||||||
import { messageHash } from "../message_hash/index.js";
|
import { messageHash } from "../message_hash/index.js";
|
||||||
|
|
||||||
const log = new Logger("message:version-0");
|
|
||||||
const OneMillion = BigInt(1_000_000);
|
const OneMillion = BigInt(1_000_000);
|
||||||
|
|
||||||
export const Version = 0;
|
export const Version = 0;
|
||||||
@ -175,18 +173,6 @@ export class Decoder implements IDecoder<IDecodedMessage> {
|
|||||||
pubsubTopic: string,
|
pubsubTopic: string,
|
||||||
proto: IProtoMessage
|
proto: IProtoMessage
|
||||||
): Promise<IDecodedMessage | undefined> {
|
): Promise<IDecodedMessage | undefined> {
|
||||||
// https://rfc.vac.dev/spec/14/
|
|
||||||
// > If omitted, the value SHOULD be interpreted as version 0.
|
|
||||||
if (proto.version ?? 0 !== Version) {
|
|
||||||
log.error(
|
|
||||||
"Failed to decode due to incorrect version, expected:",
|
|
||||||
Version,
|
|
||||||
", actual:",
|
|
||||||
proto.version
|
|
||||||
);
|
|
||||||
return Promise.resolve(undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new DecodedMessage(pubsubTopic, proto);
|
return new DecodedMessage(pubsubTopic, proto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user