Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
NagyZoltanPeter committed Apr 26, 2024
1 parent 6b41712 commit 02df7d3
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions waku/node/waku_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@ proc lightpushPublish*(
## `WakuMessage` should contain a `contentTopic` field for light node
## functionality.
if node.wakuLightpushClient.isNil() and node.wakuLightPush.isNil():
error "failed to publish message as lightpush not available"
return err("Waku lightpush not available")

let internalPublish = proc(
Expand All @@ -865,10 +866,6 @@ proc lightpushPublish*(
return await node.wakuLightPush.handleSelfLightPushRequest(pubsubTopic, message)

if pubsubTopic.isSome():
debug "publishing message with lightpush",
pubsubTopic = pubsubTopic.get(),
contentTopic = message.contentTopic,
peer = peer.peerId
return await internalPublish(node, pubsubTopic.get(), message, peer)

let topicMapRes = node.wakuSharding.parseSharding(pubsubTopic, message.contentTopic)
Expand All @@ -880,8 +877,6 @@ proc lightpushPublish*(
topicMapRes.get()

for pubsub, _ in topicMap.pairs: # There's only one pair anyway
debug "publishing message with lightpush",
pubsubTopic = pubsub, contentTopic = message.contentTopic, peer = peer.peerId
return await internalPublish(node, $pubsub, message, peer)

# TODO: Move to application module (e.g., wakunode2.nim)
Expand All @@ -896,7 +891,7 @@ proc lightpushPublish*(

var peerOpt: Option[RemotePeerInfo] = none(RemotePeerInfo)
if not node.wakuLightpushClient.isNil():
let peerOpt = node.peerManager.selectPeer(WakuLightPushCodec)
peerOpt = node.peerManager.selectPeer(WakuLightPushCodec)
if peerOpt.isNone():
let msg = "no suitable remote peers"
error "failed to publish message", msg = msg
Expand Down

0 comments on commit 02df7d3

Please sign in to comment.