Skip to content

Dispute chat subscribes to relay events twice, one subscription is never consumed #585

@BraCR10

Description

@BraCR10

Is your feature request related to a problem? Please describe.

Dispute chat subscriptions use an isolated StreamSubscription created directly in DisputeChatNotifier, separate from SubscriptionManager. At the same time, SubscriptionManager already creates a disputeChat subscription (kind 1059 filtered on adminSharedKey pubkeys) but nothing in the codebase listens to that stream. Both subscriptions run in parallel, sending duplicate REQ messages to relays, while only the isolated one is actually used.

Describe the solution you'd like

Remove the isolated subscription from DisputeChatNotifier and use the existing disputeChat stream from SubscriptionManager instead. This would eliminate the duplicate relay REQs and centralize dispute chat subscription management.

Warning: A previous attempt to do this caused a regression. SubscriptionManager refreshes all subscriptions on every session change (including when an order is created), which reset active dispute chat subscriptions mid-flow. Any implementation needs to account for this behavior.

Describe alternatives you've considered

Keeping the isolated subscription as-is. It works but leaves a dead disputeChat stream in SubscriptionManager (zero listeners) and sends unnecessary duplicate REQs to relays on every active dispute.

Additional context

  • Related files: subscription_manager.dart, dispute_chat_notifier.dart
  • Documented in docs/architecture/DISPUTE_CHAT_RESTORE.md

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions