waku-org / js-waku

JavaScript implementation of Waku v2
https://js.waku.org
Apache License 2.0
169 stars 42 forks source link

bug: wakuPeerExchangeDiscovery doesn't seem to take pubsubTopics into account #1858

Open fbarbu15 opened 8 months ago

fbarbu15 commented 8 months ago

This is a bug report

Problem

When using wakuPeerExchangeDiscovery with a wrong(non-existent or empty) pubsubtopicArray the peerExchange still works and node are discovered. Peer Exchange does not take the passed pubsub topics into consideration.

Solution

Instead of saving all peers to the peer store, discard the peers that are not on the configured shard.

chair28980 commented 8 months ago

@danisharora099 to inspect the issue and update with findings.

danisharora099 commented 8 months ago

Right! Pubsub topic is required to satiate BaseProtocol and is not taken into consideration while finding/saving peers, as peer exchange finds all peers and then Connection Manager ignores peers according to the pubsub topic.

We can not save peers in the peer store if they are not relevant to the configured pubsub topics

Updated the issue description to reflect the same