mirror of
https://github.com/logos-messaging/logos-messaging-go.git
synced 2026-08-02 15:03:12 +00:00
Filter/lightpush peer selection (Automatic -> SelectRandom, and the service-slot pubsub path) chose uniformly at random among all peers that support the protocol+pubsub topic, with no regard for connectedness. A light node that has learned many peers via discv5/peer-exchange — some of them stale/unreachable (e.g. torn-down nodes whose ENRs a bootstrap node still advertised) — would therefore keep picking dead peers, churning on failed dials and missing messages, even while a perfectly good already- connected service node (e.g. the static fleet node) was available. Add preferConnectedPeers: bias selection toward peers we are currently connected to, falling back to the full candidate set when none are connected (so behavior is unchanged when there is no connected candidate). Relates to status-im/status-go#7513. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>