From f8d09d0181cd261618399a4cd6f8cad6fa5a4887 Mon Sep 17 00:00:00 2001 From: stubbsta Date: Thu, 20 Jun 2024 12:08:35 +0200 Subject: [PATCH] nonce to reset if limit is reached --- waku/waku_rln_relay/nonce_manager.nim | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/waku/waku_rln_relay/nonce_manager.nim b/waku/waku_rln_relay/nonce_manager.nim index 6fe463ce1..c8ea2e8aa 100644 --- a/waku/waku_rln_relay/nonce_manager.nim +++ b/waku/waku_rln_relay/nonce_manager.nim @@ -49,14 +49,16 @@ proc getNonce*(n: NonceManager): NonceManagerResult[Nonce] = n.nextNonce = retNonce + 1 + # This is modified for spam testing purposes, once the limit is reached the nonce value is reset to 0 if retNonce >= n.nonceLimit: - return err( - NonceManagerError( - kind: NonceLimitReached, - error: - "Nonce limit reached. Please wait for the next epoch. requested nonce: " & - $retNonce & " & nonceLimit: " & $n.nonceLimit, - ) - ) + retNonce = 0 + # return err( + # NonceManagerError( + # kind: NonceLimitReached, + # error: + # "Nonce limit reached. Please wait for the next epoch. requested nonce: " & + # $retNonce & " & nonceLimit: " & $n.nonceLimit, + # ) + # ) return ok(retNonce)