mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-05-16 15:29:41 +00:00
forcing nonce value to wrap around once limit is reached
This commit is contained in:
parent
ea35375279
commit
cf44d13cf2
@ -156,7 +156,7 @@ proc installRelayApiHandlers*(
|
|||||||
if not node.wakuRlnRelay.isNil():
|
if not node.wakuRlnRelay.isNil():
|
||||||
# append the proof to the message
|
# append the proof to the message
|
||||||
|
|
||||||
node.wakuRlnRelay.unsafeAppendRLNProof(message, float64(getTime().toUnix())).isOkOr:
|
node.wakuRlnRelay.appendRLNProof(message, float64(getTime().toUnix())).isOkOr:
|
||||||
return RestApiResponse.internalServerError(
|
return RestApiResponse.internalServerError(
|
||||||
"Failed to publish: error appending RLN proof to message: " & $error
|
"Failed to publish: error appending RLN proof to message: " & $error
|
||||||
)
|
)
|
||||||
@ -267,7 +267,7 @@ proc installRelayApiHandlers*(
|
|||||||
|
|
||||||
# if RLN is mounted, append the proof to the message
|
# if RLN is mounted, append the proof to the message
|
||||||
if not node.wakuRlnRelay.isNil():
|
if not node.wakuRlnRelay.isNil():
|
||||||
node.wakuRlnRelay.unsafeAppendRLNProof(message, float64(getTime().toUnix())).isOkOr:
|
node.wakuRlnRelay.appendRLNProof(message, float64(getTime().toUnix())).isOkOr:
|
||||||
return RestApiResponse.internalServerError(
|
return RestApiResponse.internalServerError(
|
||||||
"Failed to publish: error appending RLN proof to message: " & $error
|
"Failed to publish: error appending RLN proof to message: " & $error
|
||||||
)
|
)
|
||||||
|
|||||||
@ -3,7 +3,7 @@ when (NimMajor, NimMinor) < (1, 4):
|
|||||||
else:
|
else:
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import chronos, stew/results, times
|
import chronos, chronicles, stew/results, times
|
||||||
import ./constants
|
import ./constants
|
||||||
|
|
||||||
export chronos, times, results, constants
|
export chronos, times, results, constants
|
||||||
@ -48,8 +48,9 @@ proc getNonce*(n: NonceManager): NonceManagerResult[Nonce] =
|
|||||||
n.nextNonce = retNonce + 1
|
n.nextNonce = retNonce + 1
|
||||||
n.lastNonceTime = now
|
n.lastNonceTime = now
|
||||||
|
|
||||||
# This is commented out only for testing purposes
|
# This is modified for testing purposes, once the limit is reached the nonce value is reset to 0
|
||||||
# if retNonce >= n.nonceLimit:
|
if retNonce >= n.nonceLimit:
|
||||||
|
retNonce = 0
|
||||||
# return err(
|
# return err(
|
||||||
# NonceManagerError(
|
# NonceManagerError(
|
||||||
# kind: NonceLimitReached,
|
# kind: NonceLimitReached,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user