mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-05-24 19:29:26 +00:00
WakuMix.start() previously ran a single sequential pipeline that ended
with mixRlnSpamProtection.registerSelf() — which publishes the new
member's idCommitment to other mix nodes via relay. With master's flow
(switch.start() then reconnectRelayPeers() then ...), running registerSelf
inline would either:
- block startup for ~62s when reconnectRelayPeers backs off, or
- run before relay peers exist and silently no-op.
Split the start() proc into:
- method start*(WakuMix): local-only init (cred load, tree restore,
plugin start). Safe to await before peers are connected.
- proc registerDoSProtectionWithNetwork*(WakuMix): kick off a background
task that retries registerSelf + saveTree indefinitely until the
broadcast lands. Cancelled when WakuMix.stop() is invoked.
waku_node.start() now wires these in order:
switch.start()
wakuMix.start() # local init, errors propagate
reconnectRelayPeers() # may back off; no longer blocks mix
wakuMix.registerDoSProtectionWithNetwork() # fire-and-forget retry
node.started = true
Re-call safety: registerDoSProtectionWithNetwork no-ops if a prior task
is still running. Lifecycle: WakuMix.stop() cancelAndWait()s the task
before calling plugin.stop().
For keystore-loaded nodes the first attempt early-returns successfully
(membershipIndex already set); the retry path only exercises for fresh
joins where the initial broadcast hits a not-yet-subscribed network.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>