Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Network] enable subscription filter except ghost node #1365

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion cmd/scaffold.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ func (fnb *FlowNodeBuilder) EnqueueNetworkInit(ctx context.Context) {
p2p.DefaultMaxPubSubMsgSize,
fnb.Metrics.Network,
pingProvider,
fnb.BaseConfig.DNSCacheTTL)
fnb.BaseConfig.DNSCacheTTL,
fnb.BaseConfig.NodeRole)

if err != nil {
return nil, fmt.Errorf("could not generate libp2p node factory: %w", err)
Expand Down
5 changes: 3 additions & 2 deletions network/p2p/libp2pNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ func DefaultLibP2PNodeFactory(ctx context.Context,
maxPubSubMsgSize int,
metrics module.NetworkMetrics,
pingInfoProvider PingInfoProvider,
dnsResolverTTL time.Duration) (LibP2PFactoryFunc, error) {
dnsResolverTTL time.Duration,
role string) (LibP2PFactoryFunc, error) {

connManager := NewConnManager(log, metrics)

Expand All @@ -82,7 +83,7 @@ func DefaultLibP2PNodeFactory(ctx context.Context,

psOpts := DefaultPubsubOptions(maxPubSubMsgSize)

if chainID != flow.Localnet {
if role != "ghost" {
psOpts = append(psOpts, func(_ context.Context, h host.Host) (pubsub.Option, error) {
return pubsub.WithSubscriptionFilter(NewRoleBasedFilter(
h.ID(), rootBlockID, idProvider,
Expand Down