Skip to content

Commit

Permalink
enable subscription filter except ghost node
Browse files Browse the repository at this point in the history
  • Loading branch information
synzhu committed Sep 27, 2021
1 parent 2ba7bcb commit f6ed91b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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

0 comments on commit f6ed91b

Please sign in to comment.