mirror of https://github.com/waku-org/nwaku.git
lightpush better feedback in case the lightpush service node does not have peers (#2951)
This commit is contained in:
parent
64855502cf
commit
ebda56dd90
|
@ -1,7 +1,7 @@
|
||||||
{.used.}
|
{.used.}
|
||||||
|
|
||||||
import
|
import
|
||||||
std/[options, tables, sequtils, tempfiles],
|
std/[options, tables, sequtils, tempfiles, strutils],
|
||||||
stew/shims/net as stewNet,
|
stew/shims/net as stewNet,
|
||||||
testutils/unittests,
|
testutils/unittests,
|
||||||
chronos,
|
chronos,
|
||||||
|
@ -86,8 +86,13 @@ suite "Waku Lightpush - End To End":
|
||||||
if not publishResponse.isOk():
|
if not publishResponse.isOk():
|
||||||
echo "Publish failed: ", publishResponse.error()
|
echo "Publish failed: ", publishResponse.error()
|
||||||
|
|
||||||
# Then the message is relayed to the server
|
# Then the message is not relayed but not due to RLN
|
||||||
assertResultOk publishResponse
|
assert publishResponse.isErr(), "We expect an error response"
|
||||||
|
assert (
|
||||||
|
publishResponse.error.contains(
|
||||||
|
"Lightpush request has not been published to any peers"
|
||||||
|
)
|
||||||
|
), "incorrect error response"
|
||||||
|
|
||||||
suite "Waku LightPush Validation Tests":
|
suite "Waku LightPush Validation Tests":
|
||||||
asyncTest "Validate message size exceeds limit":
|
asyncTest "Validate message size exceeds limit":
|
||||||
|
@ -174,5 +179,10 @@ suite "RLN Proofs as a Lightpush Service":
|
||||||
if not publishResponse.isOk():
|
if not publishResponse.isOk():
|
||||||
echo "Publish failed: ", publishResponse.error()
|
echo "Publish failed: ", publishResponse.error()
|
||||||
|
|
||||||
# Then the message is relayed to the server
|
# Then the message is not relayed but not due to RLN
|
||||||
assertResultOk publishResponse
|
assert publishResponse.isErr(), "We expect an error response"
|
||||||
|
assert (
|
||||||
|
publishResponse.error.contains(
|
||||||
|
"Lightpush request has not been published to any peers"
|
||||||
|
)
|
||||||
|
), "incorrect error response"
|
||||||
|
|
|
@ -54,5 +54,8 @@ proc getRelayPushHandler*(
|
||||||
## Agreed change expected to the lightpush protocol to better handle such case. https://github.com/waku-org/pm/issues/93
|
## Agreed change expected to the lightpush protocol to better handle such case. https://github.com/waku-org/pm/issues/93
|
||||||
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()
|
let msgHash = computeMessageHash(pubsubTopic, message).to0xHex()
|
||||||
notice "Lightpush request has not been published to any peers", msg_hash = msgHash
|
notice "Lightpush request has not been published to any peers", msg_hash = msgHash
|
||||||
|
return err(
|
||||||
|
"Lightpush request has not been published to any peers. msg_hash: " & msgHash
|
||||||
|
)
|
||||||
|
|
||||||
return ok()
|
return ok()
|
||||||
|
|
|
@ -42,8 +42,10 @@ proc handleRequest*(
|
||||||
|
|
||||||
pubSubTopic = request.get().pubSubTopic
|
pubSubTopic = request.get().pubSubTopic
|
||||||
message = request.get().message
|
message = request.get().message
|
||||||
|
|
||||||
waku_lightpush_messages.inc(labelValues = ["PushRequest"])
|
waku_lightpush_messages.inc(labelValues = ["PushRequest"])
|
||||||
notice "lightpush request",
|
|
||||||
|
notice "handling lightpush request",
|
||||||
peer_id = peerId,
|
peer_id = peerId,
|
||||||
requestId = requestId,
|
requestId = requestId,
|
||||||
pubsubTopic = pubsubTopic,
|
pubsubTopic = pubsubTopic,
|
||||||
|
|
Loading…
Reference in New Issue