fix(rln-relay): mark duplicated messages as spam (#1867)

* fix(rln-relay): mark duplicated messages as spam

* chore: fix fn desc
This commit is contained in:
Aaryamann Challani 2023-08-02 10:40:18 +05:30 committed by GitHub
parent afb93e2995
commit 4756ccc179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -100,7 +100,7 @@ method stop*(rlnPeer: WakuRLNRelay) {.async.} =
proc hasDuplicate*(rlnPeer: WakuRLNRelay,
proofMetadata: ProofMetadata): RlnRelayResult[bool] =
## returns true if there is another message in the `nullifierLog` of the `rlnPeer` with the same
## epoch and nullifier as `proofMetadata`'s epoch and nullifier but different Shamir secret shares
## epoch and nullifier as `proofMetadata`'s epoch and nullifier
## otherwise, returns false
## Returns an error if it cannot check for duplicates
@ -110,8 +110,8 @@ proc hasDuplicate*(rlnPeer: WakuRLNRelay,
return ok(false)
try:
if rlnPeer.nullifierLog[externalNullifier].contains(proofMetadata):
# there is an identical record, ignore rhe mag
return ok(false)
# there is an identical record, mark it as spam
return ok(true)
# check for a message with the same nullifier but different secret shares
let matched = rlnPeer.nullifierLog[externalNullifier].filterIt((