mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-02 14:03:06 +00:00
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
ac8ab37e7b
commit
7388134163
@ -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((
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user