mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-16 20:53:08 +00:00
chore: deduplicate ecies encrypted payloads
This commit is contained in:
parent
e8f5171d93
commit
630f97dfc3
@ -111,7 +111,16 @@ export class ServiceNodesFleet {
|
||||
return relayMessages.every((message) => message);
|
||||
}
|
||||
|
||||
public async confirmMessageLength(numMessages: number): Promise<void> {
|
||||
public async confirmMessageLength(
|
||||
numMessages: number,
|
||||
{ encryptedPayload }: { encryptedPayload?: boolean } = {
|
||||
encryptedPayload: false
|
||||
}
|
||||
): Promise<void> {
|
||||
if (encryptedPayload) {
|
||||
expect(this.messageCollector.count).to.equal(numMessages);
|
||||
}
|
||||
|
||||
if (this.strictChecking) {
|
||||
await Promise.all(
|
||||
this.nodes.map(async (node) =>
|
||||
@ -144,6 +153,12 @@ class MultipleNodesMessageCollector {
|
||||
) {
|
||||
this.callback = (msg: DecodedMessage): void => {
|
||||
log.info("Got a message");
|
||||
if (
|
||||
this.messageList.find(
|
||||
(m) => m.payload.toString() === msg.payload.toString()
|
||||
)
|
||||
)
|
||||
return;
|
||||
this.messageList.push(msg);
|
||||
};
|
||||
}
|
||||
|
||||
@ -102,8 +102,7 @@ const runTests = (strictCheckNodes: boolean): void => {
|
||||
expectedVersion: 1,
|
||||
expectedPubsubTopic: TestPubsubTopic
|
||||
});
|
||||
|
||||
await serviceNodes.confirmMessageLength(1);
|
||||
await serviceNodes.confirmMessageLength(1, { encryptedPayload: true });
|
||||
});
|
||||
|
||||
it("Subscribe and receive symmetrically encrypted messages via lightPush", async function () {
|
||||
|
||||
@ -61,7 +61,6 @@ describe("Autosharding: Running Nodes", function () {
|
||||
});
|
||||
|
||||
expect(request.successes.length).to.eq(2); // Expect 2 successes for 2 nodes
|
||||
console.log("good");
|
||||
expect(
|
||||
await serviceNodes.messageCollector.waitForMessagesAutosharding(1, {
|
||||
contentTopic: ContentTopic
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user