Skip to content

Use fanout for publish if mesh is empty even if we are subscribed to a topic#675

Open
aarshkshah1992 wants to merge 2 commits into
libp2p:masterfrom
aarshkshah1992:fix/fanout-if-mesh-is-empty
Open

Use fanout for publish if mesh is empty even if we are subscribed to a topic#675
aarshkshah1992 wants to merge 2 commits into
libp2p:masterfrom
aarshkshah1992:fix/fanout-if-mesh-is-empty

Conversation

@aarshkshah1992

@aarshkshah1992 aarshkshah1992 commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

If a peer subscribes to a topic when it has not yet seen any other peers for the topic, it will set the mesh to an empty map.

Now say another peer comes in and subscribes to the topic. But, it has not been grafted yet and has yet to be added to the mesh. However, it is now added to the list of peers subscribed to a given topic.

Now, if the first peer does a Publish -> we see that the mesh exists and so don't do a fanout. However, the mesh is empty which means that the peer above never sees the message.

Later, on a heartbeat, the second peer gets grafted but it's too late.

@aarshkshah1992

Copy link
Copy Markdown
Contributor Author

@MarcoPolo @sukunrt Please can I request you to take a look ?

Comment thread gossipsub.go Outdated
Comment thread gossipsub.go Outdated
@sukunrt sukunrt force-pushed the fix/fanout-if-mesh-is-empty branch 2 times, most recently from c448a94 to 954692f Compare June 30, 2026 13:41
@sukunrt sukunrt requested a review from MarcoPolo June 30, 2026 13:41
@sukunrt sukunrt force-pushed the fix/fanout-if-mesh-is-empty branch from 954692f to 7ae4cce Compare July 1, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants