mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-07-20 03:30:22 +00:00
* reconnect gate was "any relay peer in the peer store", not "loaded from storage" * fired even with peer persistence off (the default; FFI can't even enable it) * switch.start() boots discovery protocols before the dispatch, so bootstrap peers got swept in * backoff slept inside the per-peer loop: 62s serially per peer, connected peers included * mountRelay on a started node awaited the same sweep inline, blocking late relay mounts * PeerOrigin has no Storage value, so a "from storage only" filter isn't expressible today * the 30s relayConnectivityLoop already re-dials disconnected peers, making this path redundant * delete reconnectRelayPeers, relayReconnectFut and peerManager.reconnectPeers (no callers left) * add tests/node/test_wakunode_startup_reconnect.nim: 9 tests, 4 fail without this fix * drop the "Automatic Reconnection" sub-suite; it tested the removed proc * repair the sharded restart test: it passed via the removed sweep, not manageRelayPeers (node2 ENR now advertises Relay, node3 subscribes to its shard) * peer persistence itself is untouched; its removal is proposed as a follow-up PR Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
42 lines
1.3 KiB
Nim
42 lines
1.3 KiB
Nim
{.used.}
|
|
|
|
import std/options
|
|
import testutils/unittests, chronos, chronicles
|
|
import libp2p/switch
|
|
|
|
import logos_delivery/waku/[waku_node, waku_core, node/peer_manager]
|
|
import ../testlib/[wakucore, wakunode, testasync]
|
|
|
|
suite "WakuNode - restart (#3979)":
|
|
asyncTest "start -> stop -> start re-opens the listener promptly":
|
|
## A restart must complete promptly; historically start() could block on
|
|
## a relay-reconnect backoff sweep of the peer store (since removed).
|
|
let
|
|
node1 = newTestWakuNode(generateSecp256k1Key())
|
|
node2 = newTestWakuNode(generateSecp256k1Key())
|
|
|
|
(await node1.mountRelay()).isOkOr:
|
|
raiseAssert "mountRelay node1: " & error
|
|
(await node2.mountRelay()).isOkOr:
|
|
raiseAssert "mountRelay node2: " & error
|
|
|
|
await allFutures(node1.start(), node2.start())
|
|
|
|
# node1 learns node2 as a relay peer, so its peer store is non-empty on restart.
|
|
await node1.connectToNodes(@[node2.peerInfo.toRemotePeerInfo()])
|
|
|
|
await node1.stop()
|
|
|
|
# The restart must complete promptly and yield a usable, listening node.
|
|
let startFut = node1.start()
|
|
let restarted = await startFut.withTimeout(20.seconds)
|
|
if not restarted:
|
|
await startFut.cancelAndWait()
|
|
|
|
check:
|
|
restarted
|
|
node1.started
|
|
node1.switch.peerInfo.listenAddrs.len > 0
|
|
|
|
await allFutures(node1.stop(), node2.stop())
|