From b6855e85ab4a7fd9f25989a4de9491329638f3a9 Mon Sep 17 00:00:00 2001 From: gabrielmer <101006718+gabrielmer@users.noreply.github.com> Date: Thu, 24 Jul 2025 14:10:13 +0200 Subject: [PATCH] chore: guarding against double starting and stopping of nodes (#3525) --- waku/factory/waku.nim | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/waku/factory/waku.nim b/waku/factory/waku.nim index 27c9437ff..c6196337f 100644 --- a/waku/factory/waku.nim +++ b/waku/factory/waku.nim @@ -362,6 +362,10 @@ proc startDnsDiscoveryRetryLoop(waku: ptr Waku): Future[void] {.async.} = return proc startWaku*(waku: ptr Waku): Future[Result[void, string]] {.async.} = + if waku[].node.started: + warn "startWaku: waku node already started" + return ok() + debug "Retrieve dynamic bootstrap nodes" let conf = waku[].conf @@ -442,6 +446,9 @@ proc startWaku*(waku: ptr Waku): Future[Result[void, string]] {.async.} = proc stop*(waku: Waku): Future[void] {.async: (raises: [Exception]).} = ## Waku shutdown + if not waku.node.started: + warn "stop: attempting to stop node that isn't running" + waku.healthMonitor.setOverallHealth(HealthStatus.SHUTTING_DOWN) if not waku.metricsServer.isNil():