fanout (publish only)#21
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements a "publish-only" mode for gossipsub topics, allowing nodes to publish messages without subscribing to a topic. This is useful for fanout publishing scenarios where a node only needs to send messages but not receive them.
Changes:
- Added
publish_only_flag to Topic class to distinguish between subscribed and publish-only topics - Implemented
Gossip::publish(TopicHash, BytesIn)method that creates publish-only topics - Added fanout TTL-based cleanup for publish-only topics in the heartbeat function
- Skip sending GRAFT/subscription messages for publish-only topics to peers
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| include/libp2p/protocol/gossip/gossip.hpp | Added publish_only_ flag to Topic, last_publish_ timestamp, new publish method, and made meshOutCount() const |
| include/libp2p/protocol/gossip/config.hpp | Added fanout_ttl configuration parameter for publish-only topic cleanup |
| src/protocol/gossip/gossip.cpp | Implemented publish-only logic: topic creation, peer selection, mesh management, and cleanup |
| include/qtils/retain_if.hpp | Added utility function to filter containers in-place based on predicate |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kamilsa
approved these changes
Jan 16, 2026
xDimon
approved these changes
Jan 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gossip.publish(topic_hash, data)withoutgossip.subscribe(topic_hash)for publish only mode