go-libp2p-pubsub icon indicating copy to clipboard operation
go-libp2p-pubsub copied to clipboard

Query: GossipSub publish doesn't return failure even if node is not connected to any peers for a topic

Open chaitanyaprem opened this issue 2 years ago • 3 comments

If we are using GossipSub to publish a message for a topic, the API doesn't return any error/failure in case there are no peers available for that topic. If there are no fan-out peers identified/discovered for that topic, shouldn't an error be returned to the caller indicating that not enough peers are available to publish the message?

Especially since a node is not required to subscribe to a topic to which it wants to publish messages, I am thinking this would be a good to have.

chaitanyaprem avatar Aug 16 '23 07:08 chaitanyaprem

There is a publish option to wait until there are enough peers.

vyzo avatar Aug 16 '23 07:08 vyzo

Ok, but shouldn't it be the default option. I am wondering as to why would a node want to publish if there are no peers to publish. Is there some use-case i am missing?

chaitanyaprem avatar Aug 18 '23 07:08 chaitanyaprem

The library can't guess the user's requirements.

vyzo avatar Aug 18 '23 07:08 vyzo