Skip to content

[BUG] Event sources not properly tracked #469

@nogringo

Description

@nogringo

Describe the bug
When the same event is received from multiple relays (during query or broadcast), only the first occurrence is emitted and the sources field is not updated to reflect all relays that have the event. This results in incomplete relay hints when encoding events to NIP-19 (nevent) and makes it difficult to know which relays actually have the event.

Expected behavior
The sources field should contain all relay URLs from which the event was received. When an event is received from multiple relays, the sources should be merged instead of ignoring subsequent occurrences.

Additional context
This affects multiple parts of the codebase:

  1. StreamResponseCleaner (stream_response_cleaner.dart): Deduplicates by event ID but ignores subsequent occurrences completely instead of merging sources.
  2. _paginatedQuery (requests.dart): Same issue with seenEventIds - duplicates are ignored, sources not merged.
  3. Broadcast operations: When an event is successfully broadcast to multiple relays, the event object is never updated with the relay URLs that accepted it.

Impact:

  • NIP-19 relay hints are incomplete when encoding events
  • Pagination may be affected if relying on sources to track queried relays
  • Difficult to debug which relays have a given event

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtoTriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions