diff --git a/logos_delivery/waku/node/waku_node/lightpush.nim b/logos_delivery/waku/node/waku_node/lightpush.nim index e0ebb48f2..ae502233c 100644 --- a/logos_delivery/waku/node/waku_node/lightpush.nim +++ b/logos_delivery/waku/node/waku_node/lightpush.nim @@ -335,13 +335,14 @@ proc lightpushPublish*( # also returned for non-RLN rejections (e.g. oversized messages), so require # the error description to contain RlnValidatorErrorMsg — matching the legacy # lightpush path — to avoid unbounded on-chain RPCs on non-RLN errors. + if firstResult.isOk() or rln.isNone(): + return firstResult let isRlnRelatedFailure = - firstResult.error.code == LightPushErrorCode.OUT_OF_RLN_PROOF or - ( + firstResult.error.code == LightPushErrorCode.OUT_OF_RLN_PROOF or ( firstResult.error.code == LightPushErrorCode.INVALID_MESSAGE and firstResult.error.desc.get("").contains(RlnValidatorErrorMsg) ) - if firstResult.isOk() or rln.isNone() or not isRlnRelatedFailure: + if not isRlnRelatedFailure: return firstResult info "lightpush send rejected; refreshing merkle proof and retrying once", diff --git a/tests/node/test_wakunode_lightpush.nim b/tests/node/test_wakunode_lightpush.nim index de771348c..1db89374a 100644 --- a/tests/node/test_wakunode_lightpush.nim +++ b/tests/node/test_wakunode_lightpush.nim @@ -231,7 +231,7 @@ suite "RLN Proofs as a Lightpush Service": inc callCount if callCount == 1: return lighpushErrorResult( - LightPushErrorCode.INVALID_MESSAGE, "simulated stale merkle path" + LightPushErrorCode.INVALID_MESSAGE, RlnValidatorErrorMsg ) return lightpushSuccessResult(1) server.wakuLightPush.pushHandler = stub @@ -287,7 +287,7 @@ suite "RLN Proofs as a Lightpush Service": pubsubTopic: PubsubTopic, message: WakuMessage ): Future[WakuLightPushResult] {.async.} = inc callCount - return lighpushErrorResult(LightPushErrorCode.INVALID_MESSAGE, "still stale") + return lighpushErrorResult(LightPushErrorCode.INVALID_MESSAGE, RlnValidatorErrorMsg) server.wakuLightPush.pushHandler = stub let response = await server.lightpushPublish(some(pubsubTopic), message)