mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
The live subscription-list subscription (kind 30000) delivers our OWN list event back through handleSubscriptionListEvent, which called updateFromRelays on EVERY event. updateFromRelays re-fetches the list, the relay echoes the same event through the live sub, and the handler fires again — a self-sustaining loop that floods the cold-login burst with redundant kind-30000 REQs (the kind 30000=19 storm in the real-env console, KNOWN_BUGS #0). Same shape as the contact-list emit→fetch→emit loop fixed earlier. Add an emit-on-change guard: skip the refresh when the event is one we've already acted on (by id — matters during the pre-decrypt login window where subsEventCreatedAt isn't set yet) or is not newer than what we've applied. A genuinely newer list event still refreshes exactly once. Also extend the channel-sim harness to capture per-filter REQ signatures and kind-30000 REQ timing, which is how this loop was isolated. Test: tests/subscriptions-manager.test.mjs — echo of the same event id does not re-refresh; an older event is ignored; a newer event refreshes once. Co-Authored-By: Claude Opus 4.8 <[email protected]>