mirror of https://github.com/waku-org/nwaku.git
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:
parent
afb93e2995
commit
4756ccc179
|
@ -100,7 +100,7 @@ method stop*(rlnPeer: WakuRLNRelay) {.async.} =
|
||||||
proc hasDuplicate*(rlnPeer: WakuRLNRelay,
|
proc hasDuplicate*(rlnPeer: WakuRLNRelay,
|
||||||
proofMetadata: ProofMetadata): RlnRelayResult[bool] =
|
proofMetadata: ProofMetadata): RlnRelayResult[bool] =
|
||||||
## returns true if there is another message in the `nullifierLog` of the `rlnPeer` with the same
|
## 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
|
## otherwise, returns false
|
||||||
## Returns an error if it cannot check for duplicates
|
## Returns an error if it cannot check for duplicates
|
||||||
|
|
||||||
|
@ -110,8 +110,8 @@ proc hasDuplicate*(rlnPeer: WakuRLNRelay,
|
||||||
return ok(false)
|
return ok(false)
|
||||||
try:
|
try:
|
||||||
if rlnPeer.nullifierLog[externalNullifier].contains(proofMetadata):
|
if rlnPeer.nullifierLog[externalNullifier].contains(proofMetadata):
|
||||||
# there is an identical record, ignore rhe mag
|
# there is an identical record, mark it as spam
|
||||||
return ok(false)
|
return ok(true)
|
||||||
|
|
||||||
# check for a message with the same nullifier but different secret shares
|
# check for a message with the same nullifier but different secret shares
|
||||||
let matched = rlnPeer.nullifierLog[externalNullifier].filterIt((
|
let matched = rlnPeer.nullifierLog[externalNullifier].filterIt((
|
||||||
|
|
Loading…
Reference in New Issue