nonce to reset if limit is reached

This commit is contained in:
stubbsta 2024-06-20 12:08:35 +02:00
parent 68869a9b47
commit f8d09d0181
No known key found for this signature in database
1 changed files with 10 additions and 8 deletions

View File

@ -49,14 +49,16 @@ proc getNonce*(n: NonceManager): NonceManagerResult[Nonce] =
n.nextNonce = retNonce + 1 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: if retNonce >= n.nonceLimit:
return err( retNonce = 0
NonceManagerError( # return err(
kind: NonceLimitReached, # NonceManagerError(
error: # kind: NonceLimitReached,
"Nonce limit reached. Please wait for the next epoch. requested nonce: " & # error:
$retNonce & " & nonceLimit: " & $n.nonceLimit, # "Nonce limit reached. Please wait for the next epoch. requested nonce: " &
) # $retNonce & " & nonceLimit: " & $n.nonceLimit,
) # )
# )
return ok(retNonce) return ok(retNonce)