From 5fe415a1c31c5e1476a940326762275f78d7e56a Mon Sep 17 00:00:00 2001 From: DarshanBPatel Date: Mon, 24 Jun 2024 16:18:16 +0530 Subject: [PATCH] chore: update little flow --- waku/waku_filter_v2/protocol.nim | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/waku/waku_filter_v2/protocol.nim b/waku/waku_filter_v2/protocol.nim index f698fbcc08..4cad6e53d5 100644 --- a/waku/waku_filter_v2/protocol.nim +++ b/waku/waku_filter_v2/protocol.nim @@ -188,18 +188,18 @@ proc pushToPeers( var pushFuts: seq[Future[void]] var skipMessageToPeers: seq[PeerId] for peerId in peers: - if wf.messageArchive.hasKey(peerId): - if msgHash notin wf.messageArchive[peerId]: - let pushFut = wf.pushToPeer(peerId, bufferToPublish) - pushFuts.add(pushFut) - wf.messageArchive[peerId].incl(msgHash) - else: - skipMessageToPeers.add(peerId) - else: + if not wf.messageArchive.hasKey(peerId): + wf.messageArchive[peerId] = initHashSet[string]() + + if not wf.messageArchive[peerId].contains(msgHash): wf.messageArchive[peerId].incl(msgHash) + let pushFut = wf.pushToPeer(peerId, bufferToPublish) + pushFuts.add(pushFut) + else: + skipMessageToPeers.add(peerId) if skipMessageToPeers.len > 0: - notice "skipping message to peers: duplicate message detected", + notice "skipping message to these peers: duplicate message detected", peer_ids = skipMessageToPeers, msg_hash = msgHash await allFutures(pushFuts)