Files
bitvid/tests
thePR0M3TH3ANandClaude Opus 4.8 dcce28cc97 nip71: fix ingest never subscribing due to whitelist-hydration race
The admin whitelist hydrates asynchronously (remote fetch, then a second
hex-pubkey rebuild once NostrTools loads) and does not always emit a
change we can hook — e.g. loaded-from-cache-unchanged, or the async hex
rebuild that emits nothing. So at startup getWhitelistPubkeys() was empty,
resolveFilters() returned null, no subscription opened, and the
onWhitelistChange restart never fired: ingest stayed silent even when a
whitelisted author had foreign NIP-71 videos on the relays.

Fix: bounded retry (every 2s, ~60s) that re-attempts opening the
subscription until the author scope hydrates, in addition to the
onWhitelistChange listener. Author-scoping is kept deliberately — a broad
kinds:[21,22,...] subscription would be a REQ firehose that violates
bitvid's relay fan-out invariants.

Also adds dev-mode logging (subscribe author/kind count; per-flush events
in / injected) so ingest is observable in the console.

Tests: new race test (empty whitelist at start -> authors hydrate without
an emit -> retry subscribes); mutation-verified.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-22 15:46:28 -04:00
..
2026-02-21 16:08:33 -05:00
2026-02-21 15:53:09 -05:00