fix: add nil checks for libp2pPing and node started status

This commit is contained in:
Ivan FB 2026-03-31 11:24:23 +02:00
parent 328f3b6491
commit dc73cd23b2
No known key found for this signature in database
GPG Key ID: DF0C67A04C543270

View File

@ -38,6 +38,10 @@ proc mountLibp2pPing*(node: WakuNode) {.async: (raises: []).} =
proc pingPeer(node: WakuNode, peerId: PeerId): Future[Result[void, string]] {.async.} =
## Ping a single peer and return the result
if node.libp2pPing.isNil():
return err("cannot pingPeer because libp2pPing is nil: " & $peerId)
if not node.started:
return err("cannot pingPeer because node is not started: " & $peerId)
try:
# Establish a stream