Skip to content

Commit

Permalink
chore: update little flow
Browse files Browse the repository at this point in the history
  • Loading branch information
darshankabariya committed Jun 24, 2024
1 parent 0d65457 commit 5fe415a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions waku/waku_filter_v2/protocol.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5fe415a

Please sign in to comment.